Jump to content

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

image in bestseller box Rate Topic   - - - - -

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

Posted 24 August 2006 - 12:12 AM #1

how would i have the image of the best seller product show up in the box?

could i just copy the code over from the recently viewed and change the names of the side boxes to the correct name?


thanks
Lisa

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

 

Posted 24 August 2006 - 04:55 PM #2

From what I see in the sidebox.tpl file - in the /skins/default_magenta/customer/addons/bestsellers directory, there is the following code:

<a href="{$index_script}?{$target_name}=products&product_id={$bestseller.product_id}"...

From what I see, if you change product_id to: image_id, this may work, but I have not attempted this yet.

so the 2 codes I would change would be:
product_id = image_id
$bestseller.product_id - $bestseller.image_id


I would make a backup copy of the orignal sidebox.tpl file first, then
attempt to try this

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

Posted 24 August 2006 - 05:46 PM #3

that make sence, thanks alot
Lisa

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

 

Posted 24 August 2006 - 06:22 PM #4

Lisa,
Keep me posted and let me know if that works ;-)

-Bruce

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

Posted 24 August 2006 - 10:23 PM #5

nope, didnt work.
Lisa

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

 
  • imac
  • Head of Product
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 2076 posts

Posted 25 August 2006 - 01:46 PM #6

You can try to replace the following string:
		<a href="{$index_script}?{$target_name}=products&product_id={$bestseller.product_id}" class="sidebox-link">{$bestseller.product}</a></td>

with this one:
		<a href="{$index_script}?{$target_name}=products&product_id={$bestseller.product_id}" class="sidebox-link">{include file="products_pages/product_image.tpl" product=$bestseller image_width=$settings.Appearance.thumbnail_width obj_id=$bestseller.product_id}</a></td>


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

Posted 25 August 2006 - 05:55 PM #7

that sort of worked, i got the "no image" and there is an image to sh
Lisa

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

 
  • imac
  • Head of Product
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 2076 posts

Posted 28 August 2006 - 06:19 AM #8

In addition to the previous post, try to replace the following code in the [cscart_dir]/addons/bestsellers/func.php:
	$products = db_get_array("SELECT $db_tables[product_descriptions].product_id, $db_tables[product_descriptions].product, SUM($db_tables[product_sales].amount) as amount FROM $db_tables[product_sales] LEFT JOIN $db_tables[product_descriptions] ON  $db_tables[product_descriptions].product_id=$db_tables[product_sales].product_id AND $db_tables[product_descriptions].lang_code='$cart_language' WHERE $query GROUP BY $db_tables[product_sales].product_id ORDER BY amount DESC LIMIT $limit");

with this:
	$products = db_get_array("SELECT $db_tables[product_descriptions].product_id, $db_tables[product_descriptions].product, SUM($db_tables[product_sales].amount) as amount FROM $db_tables[product_sales] LEFT JOIN $db_tables[product_descriptions] ON  $db_tables[product_descriptions].product_id=$db_tables[product_sales].product_id AND $db_tables[product_descriptions].lang_code='$cart_language' WHERE $query GROUP BY $db_tables[product_sales].product_id ORDER BY amount DESC LIMIT $limit");

	foreach($products as $k => $v) {
		$products[$k]['main_pair'] = db_get_row("SELECT pair_id, image_id, detailed_id, type FROM $db_tables[product_images_links] WHERE product_id='$v[product_id]' AND type='M'");
		if (!empty($products[$k]['main_pair']['image_id'])) {
			$products[$k]['main_pair']['image_size'] = fn_get_image($v['product_id'], 'product', $products[$k]['main_pair']['image_id']);
		}
		if (!empty($products[$k]['main_pair']['detailed_id'])) {
			$products[$k]['main_pair']['detailed_size'] = fn_get_image($v['product_id'], 'product', $products[$k]['main_pair']['detailed_id'], false, true);
		}
	}
	if ($settings['General']['images_location'] == 'filesystem') {
		foreach($products as $k => $v) {
			// Get icon image data
			$products[$k]['icon'] = fn_get_image($v['product_id'], 'product', '', false, false);
		}
	} else {
		foreach($products as $k => $v) {
			// Get main pair image data
			$products[$k]['main_pair']['image_size'] = fn_get_image($v['product_id'], 'product', '', false, false);
		}
	}


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

Posted 28 August 2006 - 02:05 PM #9

Thankyou for the PHP code imac.

I was getting java errors with your initial code for the bestsellers sidebox.tpl, so i played around and came up with this.

{* $Id: sidebox.tpl 1032 2005-12-15 17:02:50Z lantan $ *}
{if $bestsellers}
{capture name="sidebox"}
<table cellpadding="0" cellspacing="0" border="0">
{foreach from=$bestsellers item=bestseller}

<tr>
    <td align="center">
        <a href="{$index_script}?{$target_name}=products&product_id={$bestseller.product_id}"><br />{include file="products_pages/product_image.tpl" product=$bestseller image_width="70"}</a></td>
</tr>
<tr>
    <td align="center">
        <a href="{$index_script}?{$target_name}=products&product_id={$bestseller.product_id}" class="sidebox-link">{$bestseller.product}</a></td>
</tr>
{/foreach}
</table>
{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.bestsellers content=$smarty.capture.sidebox icon="sidebox_icon_bestsellers.gif"}
{/if}

Now you can adjust the pic's size and keep the description, and with your PHP code it works perfect.

Thanks again imac.

!!! updated this post for opera users and Validation !!!

http://www.megapcs4u.co.uk/

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

Posted 28 August 2006 - 02:14 PM #10

great, i cant wait to give it a go
Lisa

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

 
  • michael
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Oct 06
  • 233 posts

Posted 11 November 2006 - 08:03 AM #11

hi, thanks, this function works well on my site.

But I want to know, how to put the image and words on the center of sidebox?

Anyone knows?
Do whatever you want to do....

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

Posted 11 November 2006 - 08:36 AM #12

did you have a look at my hack?:

http://vb.cs-cart.co...read.php?t=1353

 
  • michael
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Oct 06
  • 233 posts

Posted 14 November 2006 - 02:17 AM #13

nwsco, thanks for ur reply.

I operated as ur guide, but now, no image display. I got the scroll effection, but also the error below:

Warning: Smarty error: unable to read resource: "common_templates/image.tpl" in /data/htdocs/classes/templater/Smarty.class.php on line 1096

.

Looking forward for ur reply, thank u so much!
Do whatever you want to do....