Magento view is not showing proper prices - magento

This file (frontend/base/default/template/catalog/product/list.phtml) was edited, now is not showing the proper prices,
http://www.personalproducts4u.co.uk/hotel-toiletries/au-lait
I changed the third table tag (ONLY THE THIRD TABLE TAG)on the file above AND THE PRICES ARE SHOWING ALL THE SAME (ON DISCOUNTED PRICES)
any ideas?
this is the code I changed:(pasted it on the third table tag of the lists file)
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<th class="buy_heading">Buy</th>
<td class="buy_pay_content">1</td>
<?php
/*foreach($tierPrices as $key=>$value)
{
echo "<td class='buy_pay_content'>".number_format($tierPrices[$key]['price_qty'],0)."</td>";
} */
?>
<?php
if(count($tierPrices)):
foreach($tierPrices as $key=>$value)
{
echo "<td class='buy_pay_content'>";
echo number_format($tierPrices[$key]['price_qty'],0);
if($key == $count-1)
{
echo "+";
}
echo "</td>";
}
else:
echo '<td class="buy_pay_content">5</td>
<td class="buy_pay_content">10+</td>';
endif;
?>
<td class="buy_pay_content">Quantity</td>
</tr>
<tr>
<th class="pay_heading">Pay</th>
<td class="buy_pay_content"><?php echo $this->getPriceHtml($_product) ?><?php //echo Mage::helper('core')->currency($_product->getPrice()) ; ?>
<?php //echo Mage::helper('core')->currency($_product->getPrice()) ; ?> <?php //echo $this->getPriceHtml($_product, true)
?>
</td>
<?php
$specialprices = Mage::getModel('catalog/product')->load($_product->getId())->getSpecialPrice();
if($specialprices)
{
$specialprice =$specialprices;
}
else
{
$specialprice = 0;
}
if(count($tierPrices)):
foreach($tierPrices as $key=>$value)
{
if($specialprice < $tierPrices[$key]['price'] && $specialprice != '0'):
//echo 'special less'.$specialprice;
?>
<td class='buy_pay_content'><div class="price-box">
<p class="old-price"><span id="old-price-182" class="price"> <?php echo Mage::helper('core')->currency($tierPrices[$key]['price']) ?> </span> </p>
<p class="special-price"> <span id="product-price-182" class="price"><?php echo Mage::helper('core')->currency($specialprice) ?></span></p>
</div></td>
<?php
else:
?>
<td class='buy_pay_content'><?php echo Mage::helper('core')->currency($tierPrices[$key]['price']) ?></td>
<?php
endif;
?>
<?php }
else:
echo "<td class='buy_pay_content'>".$this->getPriceHtml($_product, true)."</td>";
echo "<td class='buy_pay_content'>".$this->getPriceHtml($_product, true)."</td>";
endif;
?>
<td class="buy_pay_content"><input type="text" class="input-text qty" title="Qty" value="" maxlength="12" id="qty" name="qty"></td>
</tr>
</table>

Well the issue seems to be the fact that getSpecialPrice() returns what ever is in the Special Price field. I could be mistaken but I don't believe you can supply special tiered prices in Magento. You can still add a static special price but as you have already experienced it will display the same price for each iteration.
You will probably need some sort of custom extension or template logic to display such sales properly.
I am not sure how you currently manage your tiered pricing, but if it is a fixed percentage for each tier you could set your tiered prices to the calculated sale prices and calculate and display the original tier prices by dividing each tiered discount percentage and display that number.

Related

Outputting the product atribute table within the product page (catalog/product/view.phtml)

I'm attempting to place the product attribute table within a div on my product page, seperately from the content of the usual collateral tabs.
I've located the code from my attributes.phtml and i've tried to just copy and paste this code into the appropriate part of my view.phtml, resulting in the following:
<div class="spec-table">
<?php if($_additional = $this->getAdditionalData()): ?>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
<tr>
<th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
</tr>
<?php } ?>
<?php endforeach; ?>
</tbody>
</table>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif;?>
</div>
When this didn't work, I tried invoking the attributes.phtml from within my view.phtml using:
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/view/attributes.phtml')->toHtml();?>
but sadly neither of these approaches seems to work, and I just end up with a blank div.
What's the best way to inject my attributes.phtml (or for that matter, the contents of any given .phtml file) into my product page at some arbitrary point?
Managed to get this to work using the following
<?php echo $this->getLayout()->createBlock('catalog/product_view_attributes')->setTemplate('catalog/product/view/attributes.phtml')->toHtml();?>

magento output custom options

Is it possible to output the available list of custom options onto the view.phtml page within Magento? Obviously the drop down lists allow you to filter down but I need to list them in a html table and allow the customer to add to cart on each item.
I will show you how to convert dropdown and multi-select options into table format. This is the code that do the trick.
<?php
$product = Mage::Registry('current_product');
$options = $product->getOptions();
//check for option exists
if($options):
foreach ($options as $option) :
//table format allows only for select options
if($option->getType()== Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN ||
$option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE):
$require = ($option->getIsRequire()) ? ' required-entry' : '';
if($option->getType()== Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN):
$value_name = 'options['.$option->getid().']';
else:
$value_name = 'options['.$option->getid().'][]';
endif;
?>
<table border="1" style="width:500px;margin-bottom:30px">
<thead>
<tr<?php if ($option->getIsRequire()) echo ' class="required"' ?>>
<th><?php echo $option->getTitle() ?></th>
<th><?php if ($option->getIsRequire()) echo '<em>*</em>' ?></th>
</tr>
</thead>
<tbody id="<?php echo 'select_'.$option->getId() ?>" class="<?php echo $require.' product-custom-option' ?>">
<?php
foreach ($option->getValues() as $values) :
$value = $values->getOptionTypeId();
$value_title = $values->getTitle();
?>
<tr>
<td>
<?php
if($option->getType()== Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN):
?>
<input type="radio" name="<?php echo $value_name; ?>" class="radio_option" id="<?php echo 'radio_option_'.$value ?>" value="<?php echo $value; ?>" />
<?php
else:
?>
<input type="checkbox" name="<?php echo $value_name; ?>" class="checkbox_option" id="<?php echo 'checkbox_option_'.$value ?>" value="<?php echo $value; ?>" />
<?php
endif;
?>
</td>
<td><?php echo $value_title; ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
<?php
endif;
endforeach;
endif;
?>
Here for dropdown options, we are using radio button to show their values. For multiselect options, checkbox inputs are used. So if checkbox appears in the table, that means it a multi select option and hence more than one checkboxes can have tick at a time. Since radio buttons are used for dropdown options, it is important to make sure that, only one radio button is checked at a time. (We need to use javascript for ensure this).
So if we are set some custom options for a product through admin like this..
The output correspond to our code will be look like this
Note: Please note that, the code is in very basic format. You may require additional css and javascripts make it more user frontly. This is for giving you a basic idea and additional css, js are hence out of box topic.
For more information about code, check out my blog
Hope it helps

Fetch the entered quantity box values from multiple quantity box to cart page in magento

I am new to Magento.
I am displaying the attributes in table format using foreach in product detail page.
Problem i am facing is when i enter the value in any quantity box, it takes the last quantity value to the cart page since i am using foreach loop to display the quantity box.I need to display the exact value which i have entered in the quantity box.
Code:
<table border="1" style="width:100%;">
<thead>
<tr>
<th>Fabric</th>
<th>Color</th>
<th>Required Qty</th>
<th>Total Cost</th>
<th>Cart</th>
</tr>
</thead>
<?php
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'fabric');
$buttonTitle = $this->__('Add to Cart');
$i=0;foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
$i++;
if($i==1) continue;
?>
<tbody>
<tr>
<td>
<?php echo $attributeArray[$option['value']] = $option['label'];
?>
</td>
<td>
<select name="color" id="color">
<option>Select Color</option>
<?php
$color = Mage::getModel('eav/config')->getAttribute('catalog_product', 'fabric_color');
$j=0;foreach ( $color->getSource()->getAllOptions(true, true) as $option_color){
$j++;
if($j==1) continue;?>
<option value="<?php echo $option_color['value'];?>" price="<?php echo $option_color['price'];?>"><?php echo $option_color['label'];?></option>
<? }
?>
</select>
</td>
<td>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<div class="qty_pan">
<input type="text" name="qty" id="qty<?=$i;?>" maxlength="12" value="1" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</td>
<td ><span class="qty<?=$i;?>" id=""><?php echo $_product->getPrice();?></span></td>
<td>
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<!-- <span id='ajax_loader' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>-->
<?php //echo $this->getChildHtml('', true, true) ?>
</td>
</tr>
</tbody>
<?php }?>
</table>
Screenshot:
https://imageshack.us/scaled/large/12/detailpage.png
Any help is appreciated!.
I Got The solution.
We can use Query String to fetch the quantity values to cart.
Yourdomain.com/checkout/cart/add?product=getId();?>&qty=1
You can use the above querystring in href.
Hope this Helps.

remove news item from the joomla newsflash

I am using the joomla newsflash in order to display the 5 most recent items in my home page. the newsflash is attached to my news & events category. now I need that one of the news & events items will not be displayed in my home newsFlash. is it possible?, thanks
For Joomla 1.5.26, a template override might be your best bet. See here for how that's done: http://forum.joomla.org/viewtopic.php?t=145996
In your case, you'd create a new file at
/templates/your_template/html/mod_newsflash/_item.php
You'd put the following code in that file. Be sure to replace "99" with the id of your article. You can get that from the Article Manager table.
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php
$my_article_id = $item->id;
if ($my_article_id !== '99') :
if ($params->get('item_title')) : ?>
<table class="contentpaneopen<?php echo $params->get( 'moduleclass_sfx' ); ?>">
<tr>
<td class="contentheading<?php echo $params->get( 'moduleclass_sfx' ); ?>" width="100%">
<?php if ($params->get('link_titles') && $item->linkOn != '') : ?>
<a href="<?php echo $item->linkOn;?>" class="contentpagetitle<?php echo $params->get( 'moduleclass_sfx' ); ?>">
<?php echo $item->title;?></a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php if (!$params->get('intro_only')) :
echo $item->afterDisplayTitle;
endif; ?>
<?php echo $item->beforeDisplayContent; ?>
<table class="contentpaneopen<?php echo $params->get( 'moduleclass_sfx' ); ?>">
<tr>
<td valign="top" ><?php echo $item->text; ?></td>
</tr>
<tr>
<td valign="top" >
<?php if (isset($item->linkOn) && $item->readmore && $params->get('readmore')) :
echo '<a class="readmore" href="'.$item->linkOn.'">'.$item->linkText.'</a>';
endif; ?>
</td>
</tr>
</table>
<?php endif; ?>
The relevant code is in the second and final PHP tags, where I've inserted an IF check which looks for your article ID and skips it if it matches.

magento summary rating of customers review

I'm using Magento and I want to accomplish the following:
Customers can write a review an rate my product. They can rate several options as price, quality etc.
When they rate the product the review and rating shows at the productpage. For each rate options i see that stars for the rating but what I want is a summary total of the rating of that customer.
So this total rating has to become the same as the total rating on the product listing.
I hope someone can help me with this one.
Thanks in advance!
In *magento/app/design/frontend/base/[your_theme]/template/review/product/view/list.phtml*
You will see the following foreach loop:
<?php foreach ($_votes as $_vote): ?>
<tr>
<th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
</div>
</td>
</tr>
<?php endforeach; ?>
This loops through each vote and outputs it as a star rating.
Change it to the following:
<?php
$_percent = 0;
foreach ($_votes as $_vote) {
$_percent = $_percent + $_vote->getPercent();
}
$_percent = $_percent / count($_votes);
?>
<tr>
<th>Aggregate rating:</th>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo $_percent ?>%;"></div>
</div>
</td>
</tr>
Instead of displaying each vote, you're now calculating the aggregate percentage, and only outputting one vote.

Resources