MOD: Thumbnail,Product info & Delete in Cart Sidebox

This mod i need it to be the last 5 items added to the cart. Plus the items don’t show in any pages except view cart. Theres like no point of it check it out at www.akmarket.com

I have tried to fix the AJAX bug with some trial & error and come up with this solution.

I am new to PHP so I don´t know if this is the best solution, but it seems to work, except for recently viewed in emty cart page.

I removed R.W. in the emty cart page. I don´t see the point to show the same parts after emty the cart. I still have the side box R.W.


  1. Add the following code in /include/customer/cart_status.php

    one line before

    extract(fn_calculate_cart_content($cart, $auth, false, false, ‘F’, false));

    ```php

    $smarty->assign_by_ref(‘cart_products’, $cart[‘products’]);



    ```


  2. Add the following code in /include/customer/cart.php (around line 54) after

    $smarty->assign_by_ref(‘cart_subtotal’, $cart[‘subtotal’]);



    ```php extract(fn_calculate_cart_content($cart, $auth, false, false, ‘F’, 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); ```



    Can someone with PHP knowledge check the added code?

    ______________

    Peter

Looks cool… would be great if it was fixed up.

When you click the “x” for remove next to the icon in the shopping cart box it just shows it at no progress for a while then goes to page cannot be displayed for me. But when I refresh the page it shows it as gone :).



And of course I still do not have the icon show up imediatly after adding it to the cart.



And I have the first Items I added instead of the last.



If it worked smoothly it would be a great! addon to CS-Cart.

This mod is great but really confusing for the end user. Did anyone get the products to show right away?



Thanks

Hey Nwsco,



I know this was a very long time ago, but do you have a code snippet to make it display (only) the last 4 items added?

what is up with “BEGIN__VBULLETIN__CODE__SNIPPET”

NFI, I think someone’s playing around with the ‘code’ and ‘php’ snippets.

or else it’s not writing to the page correctly, it’s was working earlier today

[quote name=‘Grennix’]I have tried to fix the AJAX bug with some trial & error and come up with this solution.

I am new to PHP so I don´t know if this is the best solution, but it seems to work, except for recently viewed in emty cart page.

I removed R.W. in the emty cart page. I don´t see the point to show the same parts after emty the cart. I still have the side box R.W.


  1. Add the following code in /include/customer/cart_status.php

    one line before

    extract(fn_calculate_cart_content($cart, $auth, false, false, ‘F’, false));

    ```php

    $smarty->assign_by_ref(‘cart_products’, $cart[‘products’]);



    ```


  2. Add the following code in /include/customer/cart.php (around line 54) after

    $smarty->assign_by_ref(‘cart_subtotal’, $cart[‘subtotal’]);



    ```php extract(fn_calculate_cart_content($cart, $auth, false, false, ‘F’, 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); ```



    Can someone with PHP knowledge check the added code?

    ______________

    Peter[/QUOTE]



    I don’t know anything about PHP, but this fix worked great as an AJAX fix. Thank you.



    Brandon

For those running 1.3.5 SP2, you might find that the delete button doesn’t work.



Here’s my version, I removed the truncate for mine, but left it in for you:


```php

{* $Id: [COLOR=red]cart_thumbs.tpl[/COLOR] 2006-10-31 nwsco $ *}

{if $cart_products}

{literal}

.thumb_cart_divider { border-bottom:1px dotted #808080; } /you can move this line to styles.css if you like/

{/literal}


{foreach from=$cart_products item="product" key="key"}











{/foreach}


{include file="common_templates/image.tpl" image_width=35 obj_id=$key images=$product.main_pair object_type="product"}


{$product.product[COLOR=red]|truncate:15:".."[/COLOR]}

{include file="common_templates/price.tpl" value=$product.price class="price"}

{$lang.remove} {$product.amount}x



{/if}
```

Hi



Trying to get this mod to work (v1.3.5 sp2) New vision blue. Have managed to create the cart ok but only get thumbnails to show when I go to view cart. All other pages just have the side box with no images etc.



How do we get the thumbnails to appear in this side box on all pages???



By the way, we haven’t tried Matt’s version yet, unsure where to paste the top code anyway.



Any idea please.



Barry

The post above is a copy and paste from my cart_thumbs.tpl file. Every other file was modified the same way suggested by nwsco. Here is my other file.



cart_status.php


```php

/******************************************************************************
* *
* Copyright (c) 2004-2007 CS-Cart.com. All rights reserved. *
* *
*******************************************************************************
* *
* CS-Cart is commercial software, only users who have purchased a valid *
* license through [URL]https://www.cs-cart.com/[/URL] and accept to the terms of this *
* License Agreement can install this product. *
* *
*******************************************************************************
* THIS CS-CART SHOP END-USER LICENSE AGREEMENT IS A LEGAL AGREEMENT BETWEEN *
* YOU AND YOUR COMPANY (COLLECTIVELY, "YOU") AND CS-CART.COM (HEREINAFTER *
* REFERRED TO AS "THE AUTHOR") FOR THE SOFTWARE PRODUCT IDENTIFIED ABOVE, *
* WHICH INCLUDES COMPUTER SOFTWARE AND MAY INCLUDE ASSOCIATED MEDIA, PRINTED *
* MATERIALS, AND "ONLINE" OR ELECTRONIC DOCUMENTATION (COLLECTIVELY, THE *
* "SOFTWARE"). BY USING THE SOFTWARE, YOU SIGNIFY YOUR AGREEMENT TO ALL *
* TERMS, CONDITIONS, AND NOTICES CONTAINED OR REFERENCED HEREIN. IF YOU ARE *
* NOT WILLING TO BE BOUND BY THIS AGREEMENT, DO NOT INSTALL OR USE THE *
* SOFTWARE. *
* *
* PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" *
* FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE *
* AT THE FOLLOWING URL: [URL]https://www.cs-cart.com/license.html[/URL] *
******************************************************************************/
//
// $Id: cart_status.php 4397 2007-12-06 13:43:15Z zeke $
//
if ( !defined('IN_CSCART') ) { die('Access denied'); }
sess_register('cart');
$cart['amount'] = @empty($cart['amount']) ? 0 : $cart['amount'];
$cart['subtotal'] = @empty($cart['subtotal']) ? 0 : $cart['subtotal'];
[COLOR=blue]$smarty->assign_by_ref('cart_products', $cart_products);[/COLOR]
$smarty->assign_by_ref('cart_amount', $cart['amount']);
$smarty->assign_by_ref('cart_subtotal', $cart['display_subtotal']);
if (!empty($cart['shipping_cost'])) {
$smarty->assign_by_ref('cart_shipping_cost', $cart['shipping_cost']);
}
$CALLER = __FILE__;
include CORE_DIR . 'include_addons.php';
[COLOR=blue]extract(fn_calculate_cart_content($cart, $auth, true, false));[/COLOR]
[COLOR=blue] if (!empty($cart_products)) {[/COLOR]
[COLOR=blue] foreach($cart_products as $k => $v) {[/COLOR]
[COLOR=blue] fn_gather_additional_product_data($cart_products[$k], true);[/COLOR]
[COLOR=blue] }[/COLOR]
[COLOR=blue] }[/COLOR]
?>

```

And I would also like to know how I could get it to appear in all pages as well. My fix still only shows it on the cart.



Anyway here is a screenshot of my result:

screenshot.JPG

Hi Matt



Thanks for that I will Try Again!!!



Barry

[quote name=‘mdekok3000’]For those running 1.3.5 SP2, you might find that the delete button doesn’t work.



Here’s my version, I removed the truncate for mine, but left it in for you:


```php

{* $Id: [COLOR=red]cart_thumbs.tpl[/COLOR] 2006-10-31 nwsco $ *}

{if $cart_products}

{literal}

.thumb_cart_divider { border-bottom:1px dotted #808080; } /you can move this line to styles.css if you like/

{/literal}


{foreach from=$cart_products item="product" key="key"}











{/foreach}


{include file="common_templates/image.tpl" image_width=35 obj_id=$key images=$product.main_pair object_type="product"}


{$product.product[COLOR=red]|truncate:15:".."[/COLOR]}

{include file="common_templates/price.tpl" value=$product.price class="price"}

{$lang.remove} {$product.amount}x



{/if}
```[/QUOTE]

Nice work, only one little problem:
is not xhtml...;)

I add your code but it shows fatal error. Here is my cart_status.tpl file code.


```php {* $Id: cart_status.tpl 3782 2007-08-30 06:29:35Z zeke $ *}









{if $cart_amount}

{else}

{/if}

{if $cart_amount}
{$lang.products}: {$cart_amount}

{$lang.subtotal}: {include file="common_templates/price.tpl" value=$cart_subtotal}
{else}
{$lang.cart_is_empty}
{/if}



```

I can't understand the step 3 because there is no "one line before the ?>". Could you please tell how to add this line.

Step 3 is refering to /include/customer/cart_status.[COLOR=“Red”]php[/COLOR], not a tpl file.

Why it is not working on dark steel skin. It is not showing image on the cart.:mad:

anything like this for version 2?