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()) ?>
Related
For some reason in my shop pages the short description of each product has appeared beneath each product title. I have tried coding this out using:
body.page-id-7 .woocommerce-product-details__short-description {
display: none !important;
However, I have found online that due to it being a WooCommerce page this page ID I have used is not correct.
What is the correct way to remove the product short description from the main shop page?
If anyone knows how to do this please explain in simple terms! I am not the most knowledgeable with code so a step by step would be wonderful.
I still want the product description to be visible on the individual product pages.
Please see my site to see what I am talking about.
If I understand correctly what you want to achieve, you must add this code to your CSS file:
body.archive .woocommerce-product-details__short-description {
display: none;
}
It will looks like this:
screenshot
I added woocommerce/single-product/short-description.php to my theme from the woocommerce plugin then changed the code at the bottom to this:
<?php if ( is_product() ) : ?>
<div class="woocommerce-product-details__short-description">
<?php echo $short_description; // WPCS: XSS ok. ?>
</div>
<?php endif; ?>
I'd prefer to do it with a hook but I wasn't able to find a better solution.
is_product();
Is true if you are on the single product page.
You can get the file from https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/short-description.php
I just would like to ask if anyone here is familiar with IWD's Onepage Checkout extension. By default, under the reviews block, it only shows the name of the product, there are no thumbnail images for each product. What I want to do is include a thumbnail in the list of products under review column.
When I tried modifying info.phtml inside /template/opc/onepage/review I found that this echoes all the products under the reviews block.
<?php foreach($this->getItems() as $_item): ?>
<?php echo $this->getItemHtml($_item)?>
<?php endforeach ?>
Now, I can't locate where is the items template that getItemHtml is calling. I tried modifying the default item.phtml under the base theme, but it didn't work.
I hope someone here is familiar with this extension and the location of the items template. :(
OOops. Never mind. I already located it inside base/default/template/checkout/onepage/review/item.phtml
Currently, when a product is out of stock, the 'addtocart' block disappears, but I want to change that so instead, it still displays the 'addtocart' block, but instead of the actual 'add to basket' button, it displays some text explaining that the product is out of stock.
I have managed to get this to work on simple products by taking
<?php echo $this->getChildHtml('addtocart') ?>
out of the
if ($_product->isSaleable())
section, and editing the 'addtocart' block so that if the product isn't saleable it displays the required text instead of the 'add to basket' button.
My issue is, for configurable products, whatever code dictates whether or not the 'addtocart' block is displayed isn't particularly obvious, I have looked all over view.phtml and load of other files, and grep'd through the entire directory, but the section I have already altered for simple products is the only one that shows up (in view.phtml)...
Any ideas?
it's the same code (if ($_product->isSaleable())) but in the file /app/design/frontend/base/default/template/catalog/product/view/addtocart.phtml
Turns out it was much simpler than I thought, in the 'view.phtml' file there were two sections of code:
<?php if ($_product->isSaleable() && $this->hasOptions()): ?>
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif; ?>
Which grabs 'container2' if the product is BOTH a configurable product '$this->hasOptions()' AND is saleable. Container2 has the block for displaying configurable options, related products (but just for configurable products, the line of code above this code displays the related products for simple products), and the addtocart block. Below this code I had:
<?php if (!$this->hasOptions()): ?>
<div class="add-to-box">
<?php echo $this->getChildHtml('addtocart') ?>
<?php if ($_product->isSaleable()): ?>
<?php if ($this->helper('wishlist')->isAllow() || $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
<?php endif; ?>
<?php endif; ?>
Which displays the addtocart block if the product is a simple product 'if (!$this->hasOptions()'. I had to add the following bit of code as there was nothing which told the server what to do if the product was configurable but NOT saleable:
<?php if (!$_product->isSaleable() && $this->hasOptions()){ ?>
<?php echo $this->getChildHtml('addtocart') ?>
<?php } ?>
I'm fairly new to php so that was probably pretty obvious for a lot of people, but I managed to miss it for a good week or so (lucky this isn't my full time job!), hopefully this helps others!
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()));?>