Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Shipping Description in cart and checkout

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-18-2006, 11:38 AM
 
ryan c. ryan c. is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 58
 

Default Shipping Description in cart and checkout

I am trying to get a description of the shipping next to the totals in the cart and checkout. I have foold around with this for a few days now and cant seem to figure it out. Can someone lend a hand?

See pictures...

Thannks.
Attached Thumbnails
Click image for larger version

Name:	x-cart_1.gif
Views:	196
Size:	5.7 KB
ID:	188  Click image for larger version

Name:	x-cart_2.gif
Views:	201
Size:	5.7 KB
ID:	189  
__________________
Version 4.1.8
Reply With Quote
  #2  
Old 12-19-2006, 12:31 AM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Shipping Description in cart and checkout

You are onto something with the shipping descriptions so I took some time to try and code it up...it works to a point, as soon as the page finishes refreshing (since you need to submit the form to get the updated price) the text goes away.

What I have so far:

in customer/main/cart_totals.tpl look for
Code:
<FONT class="FormButton">{$lng.lbl_delivery}: </FONT> <SELECT name="shippingid" onchange="document.cartform.submit();"> {section name=ship_num loop=$shipping} <OPTION value="{$shipping[ship_num].shippingid}" {if $shipping[ship_num].shippingid eq $cart.shippingid}selected{/if}>{$shipping[ship_num].shipping|trademark:$insert_trademark:"alt"}{if $config.Appearance.display_shipping_cost eq "Y" and ($login ne "" or $config.General.apply_default_country eq "Y" or $cart.shipping_cost gt 0)} ({include file="currency.tpl" value=$shipping[ship_num].rate}){/if}</OPTION> {/section} </SELECT>

and replace with
Code:
<script type="text/javascript"> {literal} function shipdesc() { if(document.cartform.shippingid.value==52) document.cartform.shippingdesc.value = "USPS Priority takes about 1-3 business days."; } {/literal} </script> <FONT class="FormButton">{$lng.lbl_delivery}: </FONT> <SELECT name="shippingid" onchange="shipdesc();document.cartform.submit();"> {section name=ship_num loop=$shipping} <OPTION value="{$shipping[ship_num].shippingid}" {if $shipping[ship_num].shippingid eq $cart.shippingid}selected{/if}>{$shipping[ship_num].shipping|trademark:$insert_trademark:"alt"}{if $config.Appearance.display_shipping_cost eq "Y" and ($login ne "" or $config.General.apply_default_country eq "Y" or $cart.shipping_cost gt 0)} ({include file="currency.tpl" value=$shipping[ship_num].rate}){/if}</OPTION> {/section} </SELECT> <br><br> <INPUT type="text" name="shippingdesc" disabled="true" size="60">

the shippingid.value may be different for you, im not entirely sure, it doesnt seem to correspond to the admin ordering numbers under the shipping methods section...also you can add more descriptions by using the elseif statements...some improvements would be to use the admin ordering as well as the period to be used for the descriptions, but I dont know how to call those values

I may have another go at it over the weekend, but for now I need to finish up on other things
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #3  
Old 12-19-2006, 10:15 AM
 
ryan c. ryan c. is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 58
 

Default Re: Shipping Description in cart and checkout

Cool looking good. Where did you find the value for the shipping?
__________________
Version 4.1.8
Reply With Quote
  #4  
Old 12-19-2006, 10:23 AM
 
ryan c. ryan c. is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 58
 

Default Re: Shipping Description in cart and checkout

Code:
{if document.cartform.shippingid.value==52} USPS Priority takes about 1-3 business days. {/if}


Shouldn't this work? It gives me a error

fatal error: Smarty error: [in customer/main/cart_totals.tpl line 71]: syntax error: unidentified token '.cartform.shippingid.value==52
__________________
Version 4.1.8
Reply With Quote
  #5  
Old 12-19-2006, 11:37 AM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Shipping Description in cart and checkout

it should be a javascript syntax and not a smarty syntax and it needs to be within the function, should be something like:
Code:
elseif(document.cartform.shippingid.value==50) document.cartform.shippingdesc.value="Express takes about 1 business day.";
...i think i may have found a fix for my code, going to test it now



for finding values...i changed the function to:
Code:
function shipdesc() { alert(document.cartform.shippingid.value); }
and took note of what the values were when i made changes in the shipping
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #6  
Old 12-19-2006, 11:48 AM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Shipping Description in cart and checkout

my fix didnt work, i tried to call the function using onload instead of onchange
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:42 AM.

   

 
X-Cart forums © 2001-2020