Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

MOD: Thumbnail,Product info & Delete in Cart Sidebox Rate Topic   - - - - -

 
  • nwsco
  • Senior Member
  • Members
  • Join Date: 12-Sep 06
  • 372 posts

Posted 31 October 2006 - 08:08 PM #1

A simple MOD for adding the following to the Cart side-box:
-Thumbnail
-Productname (shortened to ..., but completely visible on tooltip incl. amount)
-Delete-button




Very simple to add: it looks like quite a lot at first glance, but its just 3 simple steps:

STEP 1:
---------------------------------------

Add the following line in this file:
/skins/<skinname>/customer/side_boxes/cart.tpl
below this existing line (around line 6):
{include file="cart_pages/cart_status.tpl"}

you add this line:
{include file="cart_pages/cart_thumbs.tpl"}




STEP 2:
---------------------------------------

Create a NEW file, so open notepad or similar and put this code in:

{* $Id: cart_thumbs.tpl 2006-10-31 nwsco $ *}

{if $cart_products}
{literal}
<style>.thumb_cart_divider { border-bottom:1px dotted #808080; } /*you can move this line to styles.css if you like*/</style>
{/literal}
<table cellpadding="0" cellspacing="0" width="100%" align="center" border="0">
{foreach from=$cart_products item="product" key="key"}
<tr height="40">
<td valign="middle" class="thumb_cart_divider">
<a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}">
{include file="common_templates/image.tpl" image_width=30 obj_id=$key images=$product.main_pair object_type="product"}</a>
</td>
<td valign="middle" class="thumb_cart_divider">
<a title="{$product.amount} x {$product.product}" href="{$index_script}?{$target_name}=products&product_id={$product.product_id}" class="product-title">{$product.product|truncate:15:".."}</a>
</td>
<td align="right" valign="middle" class="thumb_cart_divider">
<a href="{$index_script}?{$target_name}=cart&cart_id={$key}&{$mode_name}=delete"><img src="{$images_dir}/delete_product.gif" width="12" height="12" border="0" alt="{$lang.remove} {$product.amount}x" title="{$lang.remove} {$product.amount}x" align="absbottom" /></a>
</td>
</tr>
{/foreach}
</table>
<br>
{/if}

Save it here, under the name cart_thumbs.tpl, so here:
/skins/<skinname>/customer/cart_pages/cart_thumbs.tpl



STEP 3:
---------------------------------------

Add the following code at the bottom of the file:
/include/customer/cart_status.php (one line before the ?>)

extract(fn_calculate_cart_content($cart, $auth, true, false));
if (!empty($cart_products)) {
foreach($cart_products as $k => $v) {
fn_gather_additional_product_data($cart_products[$k], true);
}
}

$smarty->assign_by_ref('cart_products', $cart_products);





Result looks like this:
[ATTACH]205[/ATTACH]



There's still a small bug in there, only when using ajax with the cart (this doesnt hinder any functionality though!):
If you add a product, you cannot see the thumbnail&info for this directly (ajax).
Add another one (or add the same again) and then you will see it,
so there's a delay of 1 product (presuming you dont do a page-refresh
or change to another page, but stay on the same page).

If someone has a nice solution for this, please share: i cant find the
time for this right now, sorry.

Again, all quick & dirty but should work just fine. If not, post here please.

Tested with version 1.3.4
Note that this (of course) does slow down every page a bit by a few ms.

good luck :cool:

Attached Files



 
  • snorocket
  • Forum Janitor
  • Members
  • Join Date: 15-Mar 06
  • 2519 posts

Posted 31 October 2006 - 10:49 PM #2

Very nice, looks good...with that kind of coding you should be able to make your post here work:
http://vb.cs-cart.co...read.php?t=1123
SNOROCKET.COM, Now Accepting PRE-ORDERS:
Customer Service (Helpdesk) Addon for CS-Cart v4.3.1
Quote and Invoicing Addon for CS-Cart v4.3.1

 
  • zardos
  • Senior Member
  • Members
  • Join Date: 08-Feb 06
  • 1062 posts

Posted 31 October 2006 - 11:57 PM #3

Hi nwsco

Save it here, under the name cart_thumbs.tpl, so here:
/skins/<skinname>/customer/side_boxes/cart_thumbs.tpl


Nice Mod, but the cart_thumbs.tpl needs to be in the /skins/<skinname>/customer/cart_pages/cart_thumbs.tpl

 
  • zoom4267
  • Senior Member
  • Members
  • Join Date: 27-May 06
  • 847 posts

Posted 01 November 2006 - 03:21 AM #4

nwsco
your mods are great!!. can they be put in to one place so when the final version is complete and others(me LOL) want to impliment them we can find them in one place.

Keep em' commin
Lisa

http://www.skytopdesigns.com Web designs and Development

 
  • nwsco
  • Senior Member
  • Members
  • Join Date: 12-Sep 06
  • 372 posts

Posted 01 November 2006 - 07:48 AM #5

@lisa: thanks lisa, but they're simple (and quick&dirty) ones, but do make the cart better-looking yes and seem more luxury. it would be nice it some of them would be implemented yes with an option to enable/disable in the admin.

@zardos: the file needs to be where you call it from in the {include}line,
so it can even be in the root lol, but as to my post, you're right! sorry: ill change it.

@sno:can be done 2 ways: with or without ajax. It's not a hard mod at all, just a bit time-robbing, but thats ok. If i find a day off here or there ill make it, np. It probably has to be without ajax, since i never dived into that cause i been sick for almost a year and missed the ajax-hype a bit lol, although i did implement it once. without ajax its just as fast i think and more stable.
Note that all <select>'s are hidden when the <div> comes near them. i hate
that actually, but its inevitable, since any select behaves as a window.

but if someone else get's a start and need technical help, that is also an option: i'm available.

 
  • zoom4267
  • Senior Member
  • Members
  • Join Date: 27-May 06
  • 847 posts

Posted 01 November 2006 - 11:10 AM #6

dont sell yourself short. the mods are great. q&D and all. its great that you took the time to do them ( i mean this for everyone else too) and you are posting them for all of us.
Lisa

http://www.skytopdesigns.com Web designs and Development

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 02 November 2006 - 05:01 AM #7

wicked. i will definitely implement this once .4 comes out.

thank you for putting this together.

=)
Matt Johnson

http://ecoitsf.com/

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 02 November 2006 - 05:11 AM #8

time considering i think it is fine for the u.i. client experience.

"@sno:can be done 2 ways: with or without ajax. It's not a hard mod at all, just a bit time-robbing, but thats ok."
Matt Johnson

http://ecoitsf.com/

 

Posted 07 November 2006 - 12:42 AM #9

A simple MOD for adding the following to the Cart side-box:
-Thumbnail
-Productname (shortened to ..., but completely visible on tooltip incl. amount)
-Delete-button




Very simple to add: it looks like quite a lot at first glance, but its just 3 simple steps:

STEP 1:
---------------------------------------

Add the following line in this file:
/skins/<skinname>/customer/side_boxes/cart.tpl
below this existing line (around line 6):

{include file="cart_pages/cart_status.tpl"}

you add this line:
{include file="cart_pages/cart_thumbs.tpl"}




STEP 2:
---------------------------------------

Create a NEW file, so open notepad or similar and put this code in:

{* $Id: cart_thumbs.tpl 2006-10-31 nwsco $ *}

{if $cart_products}
{literal}
<style>.thumb_cart_divider { border-bottom:1px dotted #808080; } /*you can move this line to styles.css if you like*/</style>
{/literal}
<table cellpadding="0" cellspacing="0" width="100%" align="center" border="0">
{foreach from=$cart_products item="product" key="key"}
<tr height="40">
<td valign="middle" class="thumb_cart_divider">
<a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}">
{include file="common_templates/image.tpl" image_width=30 obj_id=$key images=$product.main_pair object_type="product"}</a>
</td>
<td valign="middle" class="thumb_cart_divider">
<a title="{$product.amount} x {$product.product}" href="{$index_script}?{$target_name}=products&product_id={$product.product_id}" class="product-title">{$product.product|truncate:15:".."}</a>
</td>
<td align="right" valign="middle" class="thumb_cart_divider">
<a href="{$index_script}?{$target_name}=cart&cart_id={$key}&{$mode_name}=delete"><img src="{$images_dir}/delete_product.gif" width="12" height="12" border="0" alt="{$lang.remove} {$product.amount}x" title="{$lang.remove} {$product.amount}x" align="absbottom" /></a>
</td>
</tr>
{/foreach}
</table>
<br>
{/if}

Save it here, under the name cart_thumbs.tpl, so here:
/skins/<skinname>/customer/cart_pages/cart_thumbs.tpl



STEP 3:
---------------------------------------

Add the following code at the bottom of the file:
/include/customer/cart_status.php (one line before the ?>)

extract(fn_calculate_cart_content($cart, $auth, true, false));
if (!empty($cart_products)) {
foreach($cart_products as $k => $v) {
fn_gather_additional_product_data($cart_products[$k], true);
}
}

$smarty->assign_by_ref('cart_products', $cart_products);





Result looks like this:
[ATTACH]205[/ATTACH]



There's still a small bug in there, only when using ajax with the cart (this doesnt hinder any functionality though!):
If you add a product, you cannot see the thumbnail&info for this directly (ajax).
Add another one (or add the same again) and then you will see it,
so there's a delay of 1 product (presuming you dont do a page-refresh
or change to another page, but stay on the same page).

If someone has a nice solution for this, please share: i cant find the
time for this right now, sorry.

Again, all quick & dirty but should work just fine. If not, post here please.

Tested with version 1.3.4
Note that this (of course) does slow down every page a bit by a few ms.

good luck :cool:


I was wondering if there is any reason this would not function with 1.3.3? I followed the directions above but my screens all go blank...not sure if it is a 1.3.3 issue or if I did something incorrect...I would love to get this working and thanks!!!

Cheers,
Travis
cs-cart 1.3.5 sp2!!!! finally!!!!
;)

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 14 November 2006 - 07:25 AM #10

was the bug fixed?
Matt Johnson

http://ecoitsf.com/

 
  • nwsco
  • Senior Member
  • Members
  • Join Date: 12-Sep 06
  • 372 posts

Posted 14 November 2006 - 08:33 AM #11

i dont think there is a bug. 1.3.3 just works different and this is,as i said,
a q&d one for 1.3.4.
i saw another article explaining (today/yesterday?) some differences between 3 & 4
that might clear things up.

 
  • compernicus
  • Senior Member
  • Members
  • Join Date: 24-Mar 06
  • 136 posts

Posted 14 November 2006 - 03:37 PM #12

i saw another article explaining (today/yesterday?) some differences between 3 & 4 that might clear things up.


Yes, there are different files that control the presentation of images between the 1.3.3 and 1.3.4 versions. Basically, the code that displays images in 1.3.4 mods will not work in on older versions without several changes.
Eric Stamper

Developing my site and mods with:
CS-Cart 1.3.4 Final
Linux / Apache

 
  • nwsco
  • Senior Member
  • Members
  • Join Date: 12-Sep 06
  • 372 posts

Posted 14 November 2006 - 05:05 PM #13

thats right m8.
maybe you can place the link here were you explain this a little bit better,
so they can have a look at it? i couldnt find it anymore (1-2-3)!

thx eric! you're a real contribution to this forum, i know that!

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 15 November 2006 - 12:48 AM #14

i am going to try to lay this in.

thanks =)
Matt Johnson

http://ecoitsf.com/

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 15 November 2006 - 12:57 AM #15

works like a charm
Matt Johnson

http://ecoitsf.com/

 
  • mpjbay
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 234 posts

Posted 15 November 2006 - 01:00 AM #16

the only thing that would make this even better would be to have the thumb show up immediately without have to refresh the page.

other than that wicked mod.
Matt Johnson

http://ecoitsf.com/

 
  • akmarket
  • Member
  • Members
  • Join Date: 15-Feb 06
  • 75 posts

Posted 10 December 2006 - 04:37 AM #17

GREAT MOD

When you add items the cart goes on and on and on. Is there anyway we can make the thumbnails the last 5 items added to cart.

ALSO can we fix the bug? ill help out as much as i can :)

 
  • makstudios
  • Junior Member
  • Members
  • Join Date: 17-Feb 06
  • 8 posts

Posted 10 December 2006 - 06:42 AM #18

Great MOD... I wrote one myself before, but this one uses delete button. I LIKE...

-MAK
Regards,
Michael A. Karr
MAKstudios Custom Web Design
www.makstudios.com

 
  • nwsco
  • Senior Member
  • Members
  • Join Date: 12-Sep 06
  • 372 posts

Posted 10 December 2006 - 08:07 AM #19

GREAT MOD

When you add items the cart goes on and on and on. Is there anyway we can make the thumbnails the last 5 items added to cart.

ALSO can we fix the bug? ill help out as much as i can :)


sure, quick and dirty:

All in the NEW file (cart_thumbs.tpl):

STEP 1:
--------------------------------------------------------------

put this line ABOVE the line {foreach from=$cart_products item="product" key="key"}:
{assign var="fe_count" value=1}


STEP 2:
--------------------------------------------------------------

directly UNDER the {foreach from=$cart_products item="product" key="key"}
{if $fe_count lt 5}


STEP 3:
--------------------------------------------------------------

and directly ABOVE the {/foreach}
{/if}



note: not tested myself, so please correct if wrong......
there's other ways of doing this; this is just one of them......

 
  • akmarket
  • Member
  • Members
  • Join Date: 15-Feb 06
  • 75 posts

Posted 10 December 2006 - 06:07 PM #20

it didint work?! its the same issue