I want to add some custom information alongwith each product in the cart. Suppose I add product X to cart, I want that some extra information like color,custom price etc are also saved somewhere in the database so that I can show that custom information with each product in the cart.
Please help it is urgent.
You can customize /app/design/frontend/default/default/template/checkout/cart/item/default.phtml file as you wish.
<?php $cart_item = $this->getItem() ?>
<?php $_product = Mage::getSingleton('catalog/product')->load($cart_item->getProductId()) ?>
<?php echo $_product->getResource()->getAttribute('ATTRIBUTE_CODE')->getFrontend()->getValue($_product) ?>
This is for "select box" and don't forget to change ATTRIBUTE_CODE with your real code!
Related
Using Catalog Price Rules, I'm trying to show that there was a discount applied to the particular product once viewing the cart page. Currently, Magento stops showing the "crossed-out" price when viewing the cart, so it doesn't appear that they received a discounted price unless they go back to the product / catalog page.
The area in question is located around line 103:
template > checkout > cart > item > default.phtml
What would be the proper way to show the original price next to the current price within this section? I serioulsly have no idea how it works and can't find anything on the net regarding this, as it's much different setup than anything inside View.phtml
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
<?php else: ?>
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
<?php endif; ?>
Due to the random / low responses I get from alternate StackExchange websites, I've also posted this question here: https://magento.stackexchange.com/questions/42494/show-original-price-in-cart
and will update my question accordingly. Thanks!
You could try using $_item->getProduct()->getPrice() to get the original price.
<?php echo $this->helper('checkout')->formatPrice($_item->getProduct()->getPrice()) ?>
In my shopping cart page i need to be able to check if any added products have a particular custom option set on them - in this case a custom option called 'age_guide'.
If so i need to add a small disclaimer text line. How would i go about doing so?
If your custom option set on a product is age_guide, then in your
template/checkout/cart/item/default.phtml
around line 46
<?php echo $this->htmlEscape($_option['label']) ?>
Use below code:
<?php if($_option['label'] =='age_guide'): // or whatever your custom option label ?>
<div>
<span><?php echo $this->__('Your Disclaimer Text Goes Here');?></span>
</div>
<?php endif; ?>
I have a custom Category tpl page in OpenCart. Just recently I was about to wrap the products loop with this code:
<?php
$ids=array(444,443,145,97,459,460,454,451,450,449,445,446,447,448,457,456,387,385); // array of product id's
?>
<?php
foreach ($products as $product){
if(in_array($product['product_id'],$ids)) {
//Display item
}
}
?>
This code lets me choose specific products that I want to be displayed on this page. It works great! My problem now is that I have more than 16 products to display, and in my opencart setting my item limit is set to 16. I cannot change the settings because it would change all the other pages on my store.
Is there a way I can do this on the template page? Or, if I have to, the category controller? I would love to be able to add code to the loop. But Im up for any solution. Thanks!
I just edited the Controller file:
if ($category_info['category_id'] == '132'){
$limit=1000;
}
Now if my category has the id of 132, it will display all the products on that particular page.
I need to hide some payment methods for specific products.
I tried a plugin but it did not work.
Now I am trying to display the product ID in the cart.phtml page. so i can use jquery to hide the payment. and i want to know how to display products ids in the cart.phtml?
Or if there is another and better way to achieve this result that will be appreciated
Thanks in advance.
EDIT::
<?php if($_item->getProductId() == 27){
?>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(".paypal-logo").hide();
</script>
<? } ?>
I am using the above code in default.phtml but it taking affect on the upper checkout button and not the lower one.
Now I am trying to display the product ID in the cart.phtml page. so i
can use jquery to hide the payment. and i want to know how to display
products ids in the cart.phtml?
If that's how you want to do it:
Location of cart template files: app/design/frontend/default/default/template/checkout/cart/
Location of cart line item files app/design/frontend/default/default/template/checkout/cart/item/default.phtml
Look for where you want to put the product id to go (let's assume after the product name).
Change this:
<?php echo $this->htmlEscape($this->getProductName()) ?>
To this
<?php echo $this->htmlEscape($this->getProductName()) . " " . $this->htmlEscape($this->getId()) ?>
Edit:
If the above doesn't work also try $this->getProduct()->getId() - depending on your version of Magento
Im building a webshop on Magento Platform (still localhost) and would like to have the shipping displayed in my header cart.
Currently the shipping rate is shown okay in the main cart but in the header cart it's displayed withouth tax.
This is the code of the main cart: ( the right one with tax included)
<?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
This is the code of the header cart: ( displayed without tax)
<?php echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount(); ?>
As you can see the "getShippingIncludeTax" should be added instead of just the amount.
Any ideas how to implement this code together?
Extra:
This code also works for the header, but has the same amount withouth tax.
<?php $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
if(isset($totals['shipping']))
print __(number_format($totals['shipping']->getDat('value'),2)); ?>
would that be better ?
<?php echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingIncTax(); ?>
It's actually rather easy to see whats inside your object and what you can ask from it
<?php print_r(array_keys(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData()));?>