Jump to content

Shopping Cart, I need one table row to appear or disappear


Vank

Recommended Posts

Hi, I'm no expert coding, so I need your help.

 

I've been since days trying to make this work:

 

I have set the free shipping with a cart max. amount of 200€ (total price). When this is reached, the table row with the shipping information is set to disappear (I'm not sure if its core from PS or is from the theme). I like this feature, BUT I want to appear instead a new tr with the text: "Free Shipping!".

 

I've tried tweaking both in the shopping-cart.tpl and in the cart-summary.js files. So far I could manage to create the behaviour I want. Problem is: the row "Free Shipping!" is appearing everytime I reload the page, no matter if its up or below 200€.

 

When adding more products, or updating the quantity of the products in the cart, the price changes and the tr behaviour is as I wanted.

 

Here I'm attaching the code I edited in the cart-summary.js:

 


if (json.total_shipping <= 0)
{
$('.cart_total_delivery').fadeOut();
$('.cart_total_delivery_freeship').fadeIn();   //piece I added
} else
{
$('.cart_total_delivery').fadeIn();
$('.cart_total_delivery_freeship').fadeOut();   //piece I added

 

and the code I edited in the shopping-cart.tpl:

 

<!-- What I edited -->
			<tr class="cart_total_delivery"{if $shippingCost <= 0} style="display:none;"{/if}>
 <td colspan="6" style="text-align:right;">{l s='Total shipping:'}<br />
<span style="font-size:11px; color: #666; font-weight:normal;">Remaining amount to be added to your cart in order to obtain free shipping:</span> <span style="font-size:11px; color: #099;">{displayPrice price=$free_ship}</span></td>
 <td class="price" id="total_shipping"  style="text-align:right;">{displayPrice price=$shippingCostTaxExc}</td>
			</tr>
<tr class="cart_total_delivery_freeship" {if $free_ship > 0} style="display:table-row;"{/if}>
 <td colspan="7" style="text-align:right; color:#099; font-weight:bold;">{l s='FREE SHIPPING!'}</td>
			</tr>
<!-- /end What I edited -->

 

 

I'm attaching 3 images to show the behaviour. One with the new tr "Free Shipping!", the other with the shipping price, the 3rd after refreshing the page or opening it new with both tr (price and free shipping).

 

Can someone help me? Thanks!

post-366130-0-16468800-1345122379_thumb.jpg

post-366130-0-05106300-1345122385_thumb.jpg

post-366130-0-30911500-1345122684_thumb.jpg

Edited by Vank (see edit history)
Link to comment
Share on other sites

Hello? can someone take a look please? I'm not coder and doing as much as I can to solve this "aesthetic" (if you say so) little issue but important here in Germany as everything has to be clearly stated, so people can just not have the shipping cost disappear from the shopping cart list, but say that it is free.

 

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...