Sweet!
I’ve been wanting to do this for a LONG time. I used some of MDE’s other code he helped me with to add this, if there’s no image associated with the product. You have to place an image “no_image.gif” in your root images directory for it to work. I’ve made mine an icon that’s easy to see.
Thanks MDE!
(Add in red)
{assign var="prod_id" value=$product.product_id}
{php}
$product_id = $this->get_template_vars('prod_id');
$image_id = $database->select(array('image_id'),'cscart_product_images_links',"type='M' AND product_id=$product_id");
$image_id = $image_id[0][0];
$image_path = $database->select(array('image_path'),'cscart_product_images',"image_id=$image_id");
$image_path = $image_path[0][0];
[COLOR="Red"]if($image_path == null) {
$image_path = "no_image.gif";
}[/COLOR]
echo " ";
{/php}
{if $smarty.get.cid && $smarty.get.subcats!='Y'}
And if you want images in your order_details page, try this:
In “skins/ADMIN_SKIN/admin/orders_pages/order_details.tpl”
ADD
[COLOR=Red] [/COLOR]
AND ADD
{$oi.product_code}
[COLOR=Red]
{assign var="prod_id" value=$oi.product_id}
{php}
$product_id = $this->get_template_vars('prod_id');
$image_id = db_get_row("SELECT image_id FROM cscart_product_images_links WHERE type='M' AND product_id=$product_id");
$image_id = $image_id['image_id'];
if($image_id == null) {
$image_path = "no_image.gif";
} else {
$image_path = db_get_row("SELECT image_path FROM cscart_product_images WHERE image_id=$image_id");
$image_path = $image_path['image_path'];
if($image_path == null) {
$image_path = "no_image.gif";
}
}
[/COLOR][COLOR=Red] $this->assign('image_path',$image_path);[/COLOR]
[COLOR=Red] {/php}[/COLOR][COLOR=Red]
[/COLOR][COLOR=Red]
[/COLOR]
And if you want images in your invoice page, try this:
In “skins/CLIENT_SKIN/mail/orders_pages/invoice.tpl”
ADD
{$lang.sku}
[COLOR=Red] Image [/COLOR]
AND ADD
{$oi.product_code|default:" "}
[COLOR=Red]
{assign var="prod_id" value=$oi.product_id}
{php}
$product_id = $this->get_template_vars('prod_id');
$image_id = db_get_row("SELECT image_id FROM cscart_product_images_links WHERE type='M' AND product_id=$product_id");
$image_id = $image_id['image_id'];
if($image_id == null) {
$image_path = "no_image.gif";
} else {
$image_path = db_get_row("SELECT image_path FROM cscart_product_images WHERE image_id=$image_id");
$image_path = $image_path['image_path'];
if($image_path == null) {
$image_path = "no_image.gif";
}
}
[/COLOR][COLOR=Red] $this->assign('image_path',$image_path);
[/COLOR][COLOR=Red] {/php}
[/COLOR][COLOR=Red] [/COLOR][COLOR=Red]
[/COLOR]
tmv
August 10, 2008, 12:00am
#12
[quote name=‘mdekok3000’]
At the end of config.php, add this:[/QUOTE]
Is it right - the config.php file in the root? I added the code which you indicated and site was unaccessible.
Did you place it before the “?>”? Someone else put it after and said the same thing.
tmv
August 11, 2008, 12:00am
#14
[quote name=‘mdekok3000’]Did you place it before the “?>”? Someone else put it after and said the same thing.[/QUOTE]
Thanks you, Matt, for the replay. Yes, I placed the code before “?>” and browser gives me error message
Parse error: parse error, expecting T_OLD_FUNCTION' or
T_FUNCTION’ or T_VAR' or
‘}’’
pointing out on the string
public $db = false;
Try these new instructions. (See Posts 8, 10, and 11)
I finally got CS-Cart’s built in database function working for this. Forgot that the result is an array where the key is the field name.
tmv
August 11, 2008, 12:00am
#16
You are genius! It works!
Thank you, Matt. I made some donation
Very nice addition. Thanks
darius
August 20, 2008, 12:00am
#18
Wow, this is very great mod!!! Thank you
An issue has been discovered and fixed. Those that have it working may or may not discover this issue. I would still recommend making the change.
If for some reason this change messes something up, simply use the first version.
darius
September 8, 2008, 12:00am
#20
Under FF everything looks ok, but on IE pictures are huge.