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

Estimated Ship Time (like apple)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-24-2007, 01:30 PM
 
pyap pyap is offline
 

Member
  
Join Date: Aug 2004
Posts: 16
 

Default Estimated Ship Time in MiniCart (like apple)

I'm trying to get my minicart to display an estimated ship time similar to the one on apple's store. The minicart should display the number of days that it should take for my company to ship based on the item in the cart with the longest ship time.

So far I have:

1) Added a new INT() field to the xcart_products table called "ship_time".

2) Modified skin1/admin/product_details.tpl

Where:
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[shipping_freight]" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_shipping_freight} ({$config.General.currency_symbol})</td> <td class="ProductDetails"> <input type="text" name="shipping_freight" size="18" value="{$product.shipping_freight|formatprice|default:$zero}" /> </td> </tr>
After add:
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[ship_time]" /></td>{/if} <td class="FormButton" nowrap="nowrap">Ship time:</td> <td class="ProductDetails"> <input type="text" name="ship_time" size="18" value="{if $product.productid eq ""}{$product.ship_time|default:1000}{else}{$product.ship_time}{/if}" /> </td> </tr>
3)Modified skin1/customer/main/minicart.tpl

Where:
Code:
{if $minicart_total_items > 0}
After add:
Code:
{assign var=ship value=0} {section name=product loop=$products} {if $products[product].ship_time gt $ship} {assign var=ship value=$products[product].ship_time} {/if} {/section} <tr> <td class="VertMenuItems"><b>Estimated Ship: </b></td> <td class="VertMenuItems">{$ship} Days(s)</td> </tr>

My problem:

The code only works when viewing cart.php. All other pages show the default 0.

I think that this problem is due to the fact that I am using the $products variable. I should be using some sort of variable passed from minicart.php.

i.e. : $smarty->assign("minicart_products", $cart["products"]);
(I've tried this and it doesn't pass the new ship_time database field like the $products variable does in cart.php)

I know that this mod would be useful for others.

Any help would be greatly appreciated.

Thanks,

Scott
__________________
X-Cart 4.1.8 Gold
Windows 2000 server
Reply With Quote
  #2  
Old 08-24-2007, 02:53 PM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Estimated Ship Time (like apple)

Of course you are assuming that the customer has already entered their zip code?
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #3  
Old 08-24-2007, 03:12 PM
 
pyap pyap is offline
 

Member
  
Join Date: Aug 2004
Posts: 16
 

Default Re: Estimated Ship Time (like apple)

Quote:
Originally Posted by Vacman
Of course you are assuming that the customer has already entered their zip code?

No, this would have nothing to do with zip code.

My company sells all kinds of standard products that can be customized.

When somebody orders a product without any custom work, we can ship almost immediately.

When they customize the product, it's going to take us a few days before we can ship.

I just want to give the customers a rough idea of what our shipping lead time is.

Like I said before, I want something just like apple's store...an estimate of how long it will take us to process the order before it even gets shipped.
__________________
X-Cart 4.1.8 Gold
Windows 2000 server
Reply With Quote
  #4  
Old 08-24-2007, 03:29 PM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Estimated Ship Time (like apple)

Got it - I thought... well never mind...
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #5  
Old 08-24-2007, 03:30 PM
 
pyap pyap is offline
 

Member
  
Join Date: Aug 2004
Posts: 16
 

Default Re: Estimated Ship Time (like apple)

I got it to work with a bit of a workaround.

Personally, I think it's a pretty bad hack job, but it does work. There must be a better way.

But, technically, this a working mod!!! Maybe one of you admins could move this post.

More feedback still appreciated.

Here is the working code:

1) Added a new INT() field to the xcart_products table called "ship_time".

2)Modify includes/product_modify.php

Where:
Code:
# # Update product data # $query_data = array( "product" => $product, "keywords" => $keywords, "descr" => $descr, "fulldescr" => $fulldescr, "list_price" => $list_price, "productcode" => $productcode, "forsale" => $forsale, "distribution" => $distribution, "free_shipping" => $free_shipping, "shipping_freight" => $shipping_freight, "discount_avail" => $discount_avail, "min_amount" => $min_amount, "return_time" => $return_time, "low_avail_limit" => $low_avail_limit, "free_tax" => $free_tax,
After add:
Code:
"ship_time" => $ship_time,

3) Modify skin1/admin/product_details.tpl

Where:
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[shipping_freight]" /></td>{/if} <td class="FormButton" nowrap="nowrap">{$lng.lbl_shipping_freight} ({$config.General.currency_symbol})</td> <td class="ProductDetails"> <input type="text" name="shipping_freight" size="18" value="{$product.shipping_freight|formatprice|default:$zero}" /> </td> </tr>
After add:
Code:
<tr> {if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[ship_time]" /></td>{/if} <td class="FormButton" nowrap="nowrap">Ship time:</td> <td class="ProductDetails"> <input type="text" name="ship_time" size="18" value="{if $product.productid eq ""}{$product.ship_time|default:1000}{else}{$product.ship_time}{/if}" /> </td> </tr>
4)Modified skin1/customer/main/minicart.tpl

Where:
Code:
{if $minicart_total_items > 0}
After add:
Code:
{assign var=ship value=0} {section name=product loop=$minicart_products} {if $minicart_products[product].ship_time gt $ship} {assign var=ship value=$minicart_products[product].ship_time} {/if} {/section} <tr> <td class="VertMenuItems"><b>Estimated Ship: </b></td> <td class="VertMenuItems">{$ship} Days(s)</td> </tr>
5) Modify minicart.php

Where:
Code:
$MINICART["total_items"] = ((!empty($cart["products"]) and is_array($cart["products"]))?count($cart["products"]):0) + ((!empty($cart["giftcerts"]) and is_array($cart["giftcerts"]))?count($cart["giftcerts"]):0); }
After add:
Code:
require_once ('include/func/func.cart.php'); $minicart_products = func_products_from_scratch($cart["products"], $membershipid, false); $smarty->assign("minicart_contents", $cart["minicart_products"]);


More feedback would be appreciated.

Thanks,

Scott
__________________
X-Cart 4.1.8 Gold
Windows 2000 server
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 05:54 AM.

   

 
X-Cart forums © 2001-2020