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

#   Is there as way to display the vendor's name with the productin the cart?

##

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

Less More

- Posts: 291
- Thank you received: 26
-
-
- [](http://www.interkan.net)
-

2 years 4 months ago -  2 years 4 months ago [\#362061](#362061) by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")  *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362061 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")* was created by *[jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")*

-- HikaShop version -- : 5.1.0
-- HikaMarket version -- : 4.1.1
-- Joomla version -- : 4.4.6
-- PHP version -- : 8.1.29

On the product page, when "Sold by" is enabled, it displays "Sold by &lt;vendor name&gt;.

Is there a way to display the vendor's name in cart/show.php next to each product's name?

I thought it would be called via: Code:

&lt;?php if(!empty($this-&gt;extra_data['products'])) { foreach($this-&gt;extra_data['products'] as $key =&gt; $content) { ?&gt; &lt;td class="hikashop_order_item_&lt;?php echo $key; ?&gt;_value"&gt;&lt;?php if(isset($product-&gt;extra_data[$key])) echo $product-&gt;extra_data[$key]; ?&gt;

The name appears in emails and the backend order, but we want to display it in the cart and checkout.

Thanks!

Last edit: 2 years 4 months ago by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile"). Reason: Added code reference

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vOTA4Mzg4LWlzLXRoZXJlLWFzLXdheS10by1kaXNwbGF5LXRoZS12ZW5kb3JzLW5hbWUtd2l0aC10aGUtcHJvZHVjdGluLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

2 years 4 months ago [\#362066](#362066) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362066 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

Hello,

That's right, HikaMarket does load the vendor data during "product listing" but it doesn't load them during the "cart load" or "cart display".
Loading that data every time would be unoptimized since the cart is loaded a lot of time and you don't need to display the vendor name every time. For the "cart display", since you can have multiple displays, it could perform multiple time the same job.

It would require the right way to only load when necessary.
Otherwise, it would need to add some code in the HikaShop view in order to list the vendors in the cart and load their data.
You can see similar code in HikaShop, in the "product class" with the function "processViewFront" or in the "mail class" in the function "processOrdernotificationTemplate".

Regards,

---

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

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

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

Less More

- Posts: 291
- Thank you received: 26
-
-
- [](http://www.interkan.net)
-

2 years 4 months ago [\#362088](#362088) by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")  Replied by *[jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362088 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

We have the cart set to limit to one vendor, so I really only need to display it once.

Does that make a difference in avoiding multiple calls or in how to handle adding the extra code?

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

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

Less More

- Posts: 291
- Thank you received: 26
-
-
- [](http://www.interkan.net)
-

2 years 4 months ago -  2 years 4 months ago [\#362089](#362089) by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")  Replied by *[jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362089 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

> Jerome wrote: You can see similar code in HikaShop, in the "product class" with the function "processViewFront" or in the "mail class" in the function "processOrdernotificationTemplate".

I've done a text search for those function names and cannot find them.

I looked in classes/product.php and classes/mail.php, too, but did not find them either.

Can you point me to where these functions are in 5.1.0?

Last edit: 2 years 4 months ago by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vOTA4Mzg4LWlzLXRoZXJlLWFzLXdheS10by1kaXNwbGF5LXRoZS12ZW5kb3JzLW5hbWUtd2l0aC10aGUtcHJvZHVjdGluLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

2 years 4 months ago [\#362093](#362093) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362093 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

Hello,

We're talking about HikaMarket ; not HikaShop.
HikaMarket 5.1.0 doesn't exist, yet.
[ www.hikashop.com/support/documentation/1...arket-changelog.html](https://www.hikashop.com/support/documentation/147-hikamarket-changelog.html)

Regards,

---

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

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

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

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

Less More

- Posts: 291
- Thank you received: 26
-
-
- [](http://www.interkan.net)
-

2 years 4 months ago [\#362113](#362113) by [jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")  Replied by *[jazzmang](/forum/user/5807-jazzmang "View jazzmang's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362113 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

Sorry, I misunderstood which software classes you were referencing.

I was thinking of HikaShop because the ultimate target was the shopping cart view.

I believe I got it worked out to display what I wanted.

In case someone else was interested, this is what I came up with: Code:

$db = JFactory::getDBO(); $app = JFactory::getApplication(); $config = hikamarket::config(); $vendor_id = $product-&gt;product_vendor_id; $query = 'SELECT * FROM '.hikamarket::table('vendor').' WHERE vendor_id = ' . $vendor_id; $db-&gt;setQuery($query); $vendor = $db-&gt;loadObject(); $vendor-&gt;alias = (empty($vendor-&gt;vendor_alias)) ? $vendor-&gt;vendor_name : $vendor-&gt;vendor_alias; $vendorLink = '&lt;a href="'.hikamarket::completeLink('vendor&amp;task=show&amp;cid=' . $vendor-&gt;vendor_id . '&amp;name=' . $vendor-&gt;alias ).'"&gt;' . $vendor-&gt;vendor_name . '&lt;/a&gt;'; echo '&lt;br/&gt;&lt;span class="hikamarket_vendor"&gt;' .JText::sprintf('SOLD_BY_VENDOR', $vendorLink). '&lt;/span&gt;';

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vOTA4Mzg4LWlzLXRoZXJlLWFzLXdheS10by1kaXNwbGF5LXRoZS12ZW5kb3JzLW5hbWUtd2l0aC10aGUtcHJvZHVjdGluLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

2 years 4 months ago [\#362114](#362114) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Is there as way to display the vendor's name with the productin the cart?](/forum/23-market-how-to/908388-is-there-as-way-to-display-the-vendors-name-with-the-productin-the-cart#362114 "-- HikaShop version -- : 5.1.0 -- HikaMarket version -- : 4.1.1 -- Joomla version -- : 4.4.6 -- PHP version -- : 8.1.29  On the product page, when &quot;Sold by&quot; is enabled, it displays &quot;Sold by .  Is there a way to display the vendor's name in cart/show.php next to each product's name?  I thought it would be called via:  The name appears in emails and the backend order, but we want to display it in the cart and checkout.  Thanks!")*

Hello,

For optimisation, the best is to perform a loop in order to collect all vendors. Code:

$vendor_ids = [1 =&gt; 1]; foreach($cart-&gt;products as $product) { $vendor_id = (int)$product-&gt;product_vendor_id; if($vendor_id &gt; 0) $vendor_ids[$vendor_id] = $vendor_id; }

Then load all vendors of your cart Code:

$query = 'SELECT vendor_id, vendor_name, vendor_alias FROM '.hikamarket::table('vendor').' WHERE vendor_id IN ('.implode(',', $vendor_ids).')'; $db = JFactory::getDBO(); $db-&gt;setQuery($query); $vendors = $db-&gt;loadObjectList('vendor_id');

Then in your listing you can retrieve the vendor Code:

$vendor = $vendors[(int)$product-&gt;product_vendor_id ?? 1];

And display its name and generate the SEF URL with alias.

By doing that, you will have just one SQL query to load all vendors ; otherwise you are doing one SQL query per item in the cart.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vOTA4Mzg4LWlzLXRoZXJlLWFzLXdheS10by1kaXNwbGF5LXRoZS12ZW5kb3JzLW5hbWUtd2l0aC10aGUtcHJvZHVjdGluLXRoZS1jYXJ0P3RtcGw9bWFya2Rvd24=) 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?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

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

Time to create page: 0.056 seconds

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