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()));?>
Related
Im doing some changes on my eshop, I have moved shipping method and payment method choices from checkout page to cart page, but now those tables have lost their auto-update functionality, and this leads to getting order errors, based on "invalid payment method". I know I need to move some action, method or anything as well to the cart page, I just cant figure out what I need to move there.
Code I have moved from checkout to cart for displaying shipping methods
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
<?php wc_cart_totals_shipping_html(); ?>
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
<?php endif; ?>
functions.php action change
remove_action('woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20);
add_action('order-checkout-methods', 'woocommerce_checkout_payment', 20);
Code I have moved from checkout to cart for displaying payment methods
<?php do_action('order-checkout-methods'); ?>
Problem is not in the custom function. The auto-update worked well with this, but only when it was in checkout
Any idea, what i need to add to the cart to make it work?
I see you have moved the display of shipping methods and payment methods from the checkout page to the cart page. but the issue is the auto-update functionality has been lost. that's why you need restore these.
To restore the auto-update functionality, you will need to move the relevant actions, methods, or code that handle the update of these fields to the cart page.
I've been trying to show products in the shop page of my woocommerce store, when I use the normal shortcode method and try to use the filter by price function, it doesn't work at all.However, when I use the function woocommerce_content() to output the products, the filter works without any issues.Is there anyway to make sure the filter works with "echo do_shortcode()" method?
Also, woocommerce_content() method outputs all the products and I couldn't find a way to only output sales or most most purchased products? Is there a way to output a specific type of products while using woocommerce_content() ?
<?php echo do_shortcode('[products limit=4 columns=4]'); ?>
<?php get_sidebar();
// or do_action('woocommerce_sidebar');
?>
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()) ?>
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
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!