[Skip to main content](#vessel-content)

#   Displaying product image in shopping cart

##

- **[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")**
- [![acwilan's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26763-acwilan "View acwilan's Profile") Topic Author
- [ Offline](/forum/user/26763-acwilan)

Less More

- Posts: 25
- Thank you received: 1
-
-

13 years 2 days ago [\#131916](#131916) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#131916 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")* was created by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")*

I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com_hikashop/cart/showcart.php file. The thing is that I need to display the product image, which I don't see in the code. I do a Code:

var_dump($cart)

(inside the Code:

foreach($this-&gt;rows as $cart)

code), but I get no images in the fields.

-- url of the page with the problem -- : [ mywebsite.com/mypage](http://mywebsite.com/mypage)
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.2
-- PHP version -- : 5.3
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

13 years 2 days ago [\#131936](#131936) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#131936 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

Hi,

The cart does just contains information about "items". An item is a product in the cart, it does not contains the information of the product itself.
You have to load the product in order to access to some data, like the image, the description and other. Code:

$productClass = hikashop_get('class.product'); $product = $productClass-&gt;get( $product_id );

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")**
- [![acwilan's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26763-acwilan "View acwilan's Profile") Topic Author
- [ Offline](/forum/user/26763-acwilan)

Less More

- Posts: 25
- Thank you received: 1
-
-

12 years 11 months ago [\#132515](#132515) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  Replied by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#132515 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

I tried doing that, but the "$product" variable contains information for the product, but not the images associated.
Code:

object(stdClass)#629 (52) { ["product_id"]=&gt; string(2) "11" ["product_parent_id"]=&gt; string(1) "0" ["product_name"]=&gt; string(43) "Ceremonial Huipil from Santa Maria de Jesus" ["product_description"]=&gt; string(750) "&lt;p&gt;...&lt;/p&gt;" ["product_quantity"]=&gt; string(2) "-1" ["product_code"]=&gt; string(11) "01.1.11.2.J" ["product_published"]=&gt; string(1) "1" ["product_hit"]=&gt; string(2) "51" ["product_created"]=&gt; string(10) "1353972929" ["product_sale_start"]=&gt; string(1) "0" ["product_sale_end"]=&gt; string(1) "0" ["product_delay_id"]=&gt; string(1) "0" ["product_tax_id"]=&gt; string(1) "0" ["product_type"]=&gt; string(4) "main" ["product_vendor_id"]=&gt; string(1) "0" ["product_manufacturer_id"]=&gt; string(1) "0" ["product_url"]=&gt; string(0) "" ["product_weight"]=&gt; string(6) "10.000" ["product_keywords"]=&gt; string(0) "" ["product_weight_unit"]=&gt; string(2) "kg" ["product_modified"]=&gt; string(10) "1382738149" ["product_meta_description"]=&gt; string(0) "" ["product_dimension_unit"]=&gt; string(1) "m" ["product_width"]=&gt; string(5) "0.000" ["product_length"]=&gt; string(5) "0.000" ["product_height"]=&gt; string(5) "0.000" ["product_max_per_order"]=&gt; string(1) "0" ["product_access"]=&gt; string(3) "all" ["product_group_after_purchase"]=&gt; string(0) "" ["product_min_per_order"]=&gt; string(1) "0" ["product_contact"]=&gt; string(1) "0" ["product_last_seen_date"]=&gt; string(10) "1384478263" ["product_sales"]=&gt; string(1) "0" ["product_waitlist"]=&gt; string(1) "0" ["product_layout"]=&gt; string(0) "" ["product_average_score"]=&gt; string(1) "0" ["product_total_vote"]=&gt; string(1) "0" ["product_page_title"]=&gt; string(0) "" ["product_alias"]=&gt; string(0) "" ["product_price_percentage"]=&gt; string(9) "0.0000000" ["product_msrp"]=&gt; string(9) "0.0000000" ["product_canonical"]=&gt; string(0) "" ["product_age"]=&gt; string(37) "Approximately woven in the 2000â€™s " ["product_ethnic_group"]=&gt; string(10) "Kakchiquel" ["product_materials"]=&gt; string(28) "Cotton and mercerized cotton" ["product_origin_department"]=&gt; string(1) "1" ["product_origin_municipal"]=&gt; string(15) " SacatepÃ©quez " ["product_technique"]=&gt; string(26) "Woven on a back strap loom" ["product_use"]=&gt; string(17) "Ceremonial Huipil" ["product_size"]=&gt; string(30) "Approximately 34â€&#157; x 38.5â€&#157; " ["product_display_quantity_field"]=&gt; string(1) "0" ["alias"]=&gt; string(43) "ceremonial-huipil-from-santa-maria-de-jesus" }

- [ ![h47de655.png](/forum/attachment/13686) ](/forum/attachment/13686 "h47de655.png") [ ](/forum/attachment/13686?download=1 "h47de655.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 11 months ago [\#132549](#132549) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#132549 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

Hi,

I think that you have to use the following code to get the image path: Code:

$productClass = hikashop_get('class.product'); $productClass-&gt;getProducts( $product_id ); $product = $productClass-&gt;products;

The following user(s) said Thank You: [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")**
- [![acwilan's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26763-acwilan "View acwilan's Profile") Topic Author
- [ Offline](/forum/user/26763-acwilan)

Less More

- Posts: 25
- Thank you received: 1
-
-

12 years 11 months ago [\#132589](#132589) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  Replied by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#132589 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

Thank you, that worked, although I had to code
Code:

$productClass = hikashop_get('class.product'); $productClass-&gt;getProducts($cart-&gt;product_id); $products = $productClass-&gt;products; $product = reset($products);

since the var contained an array of products with one single product.

Now another question, how do I load the image helper? I have this code to display the images for the product
Code:

if (!empty($product-&gt;images)) { $image = reset($product-&gt;images); $width = $this-&gt;config-&gt;get('thumbnail_x'); $height = $this-&gt;config-&gt;get('thumbnail_y'); $this-&gt;image-&gt;checkSize($width,$height,$image); if (!$this-&gt;config-&gt;get('thumbnail')) { echo '&lt;img src="'.$this-&gt;image-&gt;uploadFolder_url.$image-&gt;file_path.'" alt="'.$image-&gt;file_name.'" id="hikashop_main_image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" /&gt;'; } else { ?&gt; &lt;div class="hikashop_cart_product_image_thumb" &gt; &lt;?php echo $this-&gt;image-&gt;display($image-&gt;file_path,true,$image-&gt;file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"', '', $width, $height); ?&gt; &lt;/div&gt;&lt;?php } }

but it doesn't work since $this-&gt;image is not defined.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

12 years 11 months ago [\#132636](#132636) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#132636 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

Hi,
Code:

$this-&gt;image = hikashop_get('helper.image');

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")**
- [![acwilan's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26763-acwilan "View acwilan's Profile") Topic Author
- [ Offline](/forum/user/26763-acwilan)

Less More

- Posts: 25
- Thank you received: 1
-
-

12 years 11 months ago [\#132936](#132936) by [acwilan](/forum/user/26763-acwilan "View acwilan's Profile")  Replied by *[acwilan](/forum/user/26763-acwilan "View acwilan's Profile")* on topic *[Displaying product image in shopping cart](/forum/31-development/863535-displaying-product-image-in-shopping-cart#132936 "I am building a custom template for hikashop. I have a menu item that leads to the cart display. So I'm overriding the com&#95;hikashop/cart/showcart.php file. The thing is that I need to display the...")*

Thanks, that did the work.

Cheers,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg2MzUzNS1kaXNwbGF5aW5nLXByb2R1Y3QtaW1hZ2UtaW4tc2hvcHBpbmctY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.067 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
