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

Adding Per Product Update control in basket?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-05-2006, 04:51 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default Adding Per Product Update control in basket?

I have seen this on several other x-cart based sites.

Is there a guide to adding an update per product, not just for the whole cart?

Also, I would like to use the small thumbnail shown on home also show in the cart.

Looking at the debugger, I see that they both pull in products_thumbnail.tpl, but looking at the template, I don't see what controls the displayed size.

Anyone?

Thanks
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #2  
Old 03-05-2006, 06:29 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default My cart mods

Ok, both mysteries solved. For sake of the board, I'll post my hacks.

If you want to mod the cart to show the thumbnail-sized image (very handy), simply replace this at line 19 in cart.tpl
Code:
{if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {else} {include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$products[product].image_x image_y=$products[product].image_y product=$products[product].product tmbn_url=$products[product].tmbn_url} {/if}
With this
Code:
{if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {else} {include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url} {/if}
I also removed {$products[product].descr} from line 29.

I see no reason to show customers anything but the thumb, title and any options.

To add an update, per line item, you can replace the following around line 59:
Code:
{include file="buttons/delete_item.tpl" href="cart.php?mode=delete&productindex=`$products[product].cartid`"} {if $products[product].product_options ne ''} {if $config.UA.platform eq 'MacPPC' && $config.UA.browser eq 'MSIE'} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" js_to_href="Y"} {else} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');"} {/if} {/if}
With
Code:
<div style="padding: 8px 0px;"> {if $js_enabled} {include file="buttons/update.tpl" type="input" href="javascript: document.cartform.submit()" js_to_href="Y"} {/if} {include file="buttons/delete_item.tpl" href="cart.php?mode=delete&productindex=`$products[product].cartid`"} {if $products[product].product_options ne ''} {if $config.UA.platform eq 'MacPPC' && $config.UA.browser eq 'MSIE'} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" js_to_href="Y"} {else} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');"} {/if} {/if}</div>
yes, there will be TWO closing DIVs in your cart.tpl with this addition.

Now, I just need to find the hacks to the button templates to replace the text with images. If anyone cares to share, that would be superb!

Hope this helps all that follow.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #3  
Old 03-05-2006, 07:28 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default Not exactly what I want, but it works for now

Ok, as I continue to talk to myself, here are a few more changes I made to Cart.tpl

Around line 89, I hid the update and clear cart with simple HTML Comment tags. Just in case I ever want them back, no need to remove, just hide. Then I added a "Continue Shopping" link as follows:
Code:
{if $js_enabled} <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <TR> <TD>{include file="buttons/button.tpl" button_title=$lng.lbl_continue style="button" href="javascript:history.go(-1)" js_to_href="Y"} </TD> {if $active_modules.Special_Offers} {include file="modules/Special_Offers/customer/cart_checkout_buttons.tpl"} {/if} <TD align="right"> {include file="buttons/button.tpl" button_title=$lng.lbl_checkout style="button" href="cart.php?mode=checkout"} </TD> </TR> </TABLE>
This is the same way x-cart draws the Checkout button (NOTE: I also added the "Continue Shopping" label in the language file, using the variable lbl_continue and "<< Continue Shopping" just to match the "action" of the text). I also changed "Checkout" to "Checkout >>"

You can also use home.php. I chose to go with javascript:history.go(-1) for the Continue Shopping link. One nice thing about X-cart is that it uses javascript for updates and things within the cart. So history does not appear to be affected by updates and removes. So you can either send people back to the last page they were on, or to the home page. Anyone know how to send them back to the Category of the product they were on?

Now I will go back and clean up the Update and Remove links in their respective templates with the change I made to Continue Shopping to make them "buttons" too.

Closer to what I want.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #4  
Old 03-05-2006, 08:23 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

And now, here are the cleaned up Update and Remove "buttons" for the cart. Remember, this is around line 59:
Code:
<div style="padding: 8px 0px;"> <table width="100%"><tr><td valign="top"> {if $js_enabled} {include file="buttons/button.tpl" button_title=$lng.lbl_update style="button" href="javascript: document.cartform.submit()" js_to_href="Y"} {/if}</td> <td valign="top"> {include file="buttons/button.tpl" button_title=$lng.lbl_delete_item style="button" href="cart.php?mode=delete&productindex=`$products[product].cartid`"} </td><td valign="top"> {if $products[product].product_options ne ''} {if $config.UA.platform eq 'MacPPC' && $config.UA.browser eq 'MSIE'} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" js_to_href="Y"} {else} {include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');"} {/if} {/if}</td> </tr></table> </div>

Nice and simple!
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #5  
Old 03-07-2006, 08:01 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default why use home.php instead of history go

Ok,

One thing to keep in mind, is that if you are going to use the STATIC catalog feature, which I strongly suggest, you should send people back to "home.php" instead of using the javascript history.go(-1) in your Continue Shopping button. That's because if they add to cart, then the history would kick them out of your store (the dynamic part).

You want to try and keep them inside to be able to checkout and make you $$$.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 02:29 AM.

   

 
X-Cart forums © 2001-2020