Jump to content

How to get the category source image


Recommended Posts

Can anyone help me how to get the category source image?
I have this in my content.category.php

{if isset($category.image)}
<div id="category_image">

<a href="{$category.image}" target="_blank"> <img src="{$category.image}" alt="{$category.cat_name}" id="preview" /> </a>

but this opens the image from the cache. I want to be able to display  the source image.
Please help. Thanks

Link to comment
Share on other sites

Welcome aRJayCee! Glad to see you made it to the forums.


There are some places in the CubeCart code where you get an array of images that your skin can choose from, and some places in the code where you get no choices.


The category image is not one where you have a choice - currently. So, we need to modify some code.


In the file /classes/catalogue.class.php, near line 129 (for CC5211), edit:

$vars['category']['image'] = $this->imagePath($catData['cat_image'], 'category','url');
$vars['category']['image'] = $this->imagePath($catData['cat_image'], 'source','url');

There will be a different solution if what you want is to display the appropriately sized image from the cache to fit the layout of your skin, then show the source image in a new window when clicked on the link you added. To do that, make this edit:

$vars['category']['image'] = $this->imagePath($catData['cat_image'], 'category','url');
$vars['category']['image']['cat'] = $this->imagePath($catData['cat_image'], 'category','url');
$vars['category']['image']['source'] = $this->imagePath($catData['cat_image'], 'source','url');

Then, in your skin template:

<div id="category_image"><img src="{$category.image}" alt="{$category.cat_name}" /></div>
<a href="{$category.image.source}" target="_blank"><img src="{$category.image.cat}" alt="{$category.cat_name}" id="preview" /></a>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...