X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Pre-Login Shipping Calculator (https://forum.x-cart.com/showthread.php?t=6927)

DogByteMan 05-27-2004 09:23 PM

removed

DogByteMan 05-28-2004 05:10 AM

Anyone know the variables in 3.4.x that match those of this mod?

rackit 05-28-2004 08:10 AM

DogByteMan, unfortunately, I've never used 3.4.x so I'm not sure how to work it. If you send me a copy of your cart.php, I might be able to figure it out.

DogByteMan 05-28-2004 01:12 PM

It appears that the variable in this line of code is wrong for 3.4.x

{if $not_logged_message eq "1"}

Anybody know what this should be for 3.4.x in cart_totals.tpl

Code:

{if $not_logged_message eq "1"}

{if $estimate ne "NO"}

Enter your zip code to calculate shipping charges.
 
<input type=TEXT name='zip_estimate' size=5 maxlength=5>
<input type=image alt="Calculate Shipping" src="../skin1/images/calculate.gif" border=0 align=middle name=btnCalculate >

{else}

Click here to change your zip code

{/if}
{/if}


rackit 05-28-2004 01:38 PM

OK, it looks to me like 3.4.x doesn't have the equivalent of that variable, so we'll have to make one. Try adding this somewhere near the top of cart.php.

Code:


if(!$login){
      $smarty->assign("not_logged_message","1");
}
else{
      $smarty->assign("not_logged_message","0");
}


And, as always, BACK UP! :)

DogByteMan 05-28-2004 02:14 PM

That Did It! =D> \:D/


THANK YOU!!!!

DogByteMan 05-28-2004 02:39 PM

OK, first off a big THANK YOU to rackit for this mod!

rackit's mod for 3.4.x

In Langages under Add New Entry enter the following

lbl_calculate Calculate Calculate


In edit templates - buttons/

create new file calculate.tpl


Open calculate.tpl and insert this code

Code:

<font class=FormButton>{$lng.lbl_calculate} <img { include file="buttons/go_image.tpl" }></font>


In customer/cart.php

Just Below This Code

Code:

#
# $Id: cart.php,v 1.153.2.8 2003/09/10 06:14:10 svowl Exp $
#
# This script implements shopping cart facility
#

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";

//include "./nocookie_warning.php";


Add This Code

Code:

if(!$login){
      $smarty->assign("not_logged_message","1");
}
else{
      $smarty->assign("not_logged_message","0");
}

x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");
x_session_register("zipcode_estimate");

   
if($HTTP_GET_VARS['zip_estimate'] == "clear"){
      $zipcode_estimate = "";
      func_header_location("cart.php");
      }
   
if(!empty($HTTP_POST_VARS['zip_estimate'])){
      $zipcode_estimate = $_POST['zip_estimate'];
       
      $count = substr_count($zipcode_estimate,"0") + substr_count($zipcode_estimate,"1") + substr_count($zipcode_estimate,"2") + substr_count($zipcode_estimate,"3") + substr_count($zipcode_estimate,"4") + substr_count($zipcode_estimate,"5") + substr_count($zipcode_estimate,"6") + substr_count($zipcode_estimate,"7") + substr_count($zipcode_estimate,"8") + substr_count($zipcode_estimate,"9");

      if($count != 5){  //checking for 5 digits
          $zipcode_estimate = "";}
             
      func_header_location("cart.php");
      }
if($zipcode_estimate != ""){
      $config["General"]["apply_default_country"] = "Y";
      $config["General"]["default_zipcode"] = $zipcode_estimate;
      $smarty->assign("estimate","NO");
      }


Replacing or Deleting This Existing Code Which Is Already Included In The Above Code

Code:

x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");



In customer/main/cart_totals.tpl

Right Below This Code

Code:

<TR>
<TD nowrap><font class=FormButton>{$lng.lbl_order_total}:</font></TD>
<TD>[img]{$ImagesDir}/null.gif[/img]
</TD>
<TD nowrap align=right><font class=ProductPriceSmall>{include file="currency.tpl" value=$cart.total_cost}</font></TD>
<TD nowrap align=right>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$cart.total_cost}</TD>
</TABLE>


ADD This Code

Code:

{if $not_logged_message eq "1"}

{if $estimate ne "NO"}



Enter your zip code to calculate shipping charges.

 
<input type=TEXT name='zip_estimate' size=5 maxlength=5>
{if $js_enabled}
{include file="buttons/calculate.tpl"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_calculate}
{/if}

{else}


Click here to change your zip code

{/if}
{/if}



Your Done!

Again a HUGE THANK YOU to rackit! =D>[/code]

rackit 05-28-2004 07:30 PM

\:D/

DogByteMan 05-29-2004 07:17 AM

My post above has been edited to reflect a more consistent look and feel of the X-Cart

donna8284 05-31-2004 01:09 PM

Has anyone gotten this to work on v3.5.8 yet? I had it working on 3.5.1 but have recently upgraded and can not get it to work again. Thanks!!


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

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