X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Shipping Description in cart and checkout (https://forum.x-cart.com/showthread.php?t=27442)

ryan c. 12-18-2006 11:38 AM

Shipping Description in cart and checkout
 
2 Attachment(s)
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.

inebriate 12-19-2006 12:31 AM

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

ryan c. 12-19-2006 10:15 AM

Re: Shipping Description in cart and checkout
 
Cool looking good. Where did you find the value for the shipping?

ryan c. 12-19-2006 10:23 AM

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

inebriate 12-19-2006 11:37 AM

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

inebriate 12-19-2006 11:48 AM

Re: Shipping Description in cart and checkout
 
my fix didnt work, i tried to call the function using onload instead of onchange


All times are GMT -8. The time now is 03:44 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.