display product information in the cart page - php

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

Related

Magento - show Original Price in Cart template

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()) ?>

IWD Onepage Checkout getItemHtml template in Magento

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

Add link to Shopping Cart on Woocommerce's Checkout page

I've seen many tutorials dealing on how to customize woocommerce's checkout page by adding or removing fields.
But what I want is to place a link or button on the Woocommerce Checkout page saying "Return to Cart" (obviously linking to the cart page) but I want it placed just after the "Your Order" section, (the section where you review your order). I want it there because I want it along with a text saying something like "If you want to change your order return to Cart".
If I edit the actual checkout page and add the link there, it shows all the way to the bottom so maybe I have to add code to the theme's functions file? Any guidance will be greatly appreciated.
Thank you.
EDIT:
Ok, I've found a very crappy way of doing it.
I just added this line to the review-order.php file located in woocommerce/templates/checkout/ , right after the shop_table class:
<?php echo "<strong>If you'd like to change your order, go back to <a href='http://www.mysite.com/cart/'>My Cart</a></strong><br />"; ?>
This does the trick, but everytime I update woocommerce I will have to added it again.
Any suggestion of a more practical and intelligent way of doing it?
Create a child theme.
Put this in the child theme's functions.php
/**
* Add link back to cart after order review on Checkout
*/
add_action( 'woocommerce_review_order_before_payment', 'my_back_to_cart_link' );
function my_back_to_cart_link(){
//get the cart link
global $woocommerce;
$cartUrl = $woocommerce->cart->get_cart_url();
//the HTML markup to add
$backToCartLink="<p class='backtocart'><a class='button alt' href='".$cartUrl."'>".__('Edit Cart','wooint')."</a></p>";
echo $backToCartLink;
}
Well, if you created a child theme you could have put that line in your child's functions.php and then the only way an update would affect it is if they changed the coding.

Can I give my own custom link to some categories in wp - ecommerce?

I am using Mazine template demo which is using wp-ecommerce plugin, In my website I have setup left Categories and Brands widgets, What I need is to link some of categories/Brands to link to my own custom URLs instead of opening category page.
Can I do that? Which specific file I need to change to achieve this?
Thanks
At last got the solution,
Just Edit wpsc-category_widget.php file under Mazine folder , and added some conditions to change the link of some of categories.
<?php if($ti_curr_cat['name']=="Category Name"){ ?>
<?php echo $ti_curr_cat['name']; ?>
<?php }else{?>
<?php echo $ti_curr_cat['name']; ?>
<?php }?>
I've been using http://ecommerceshoppingcart4u.com to build an ecommerce site. It only involves a one off payment which is very cheap. The price is £267

getShippingIncludeTax - the right way to code

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()));?>

Categories