VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: ITN on December 29, 2013, 16:32:02 PM

Title: How to add/get manufacturer's logo to the object list?
Post by: ITN on December 29, 2013, 16:32:02 PM
Hello.

First of all, I'm new here. I hope I made this thread in the right section of forum.

So I'm making my own list/catalog of virtuemart products and everything works great, except one thing...

Here is my code:

$db = JFactory::getDBO();
$query = "SELECT virtuemart_product_id, product_sku FROM ...."; // My custom query
$db->setQuery($query);
$items = $db->loadObjectList();

$itemsIDs = FALSE;

foreach($items as $item)
{
$itemsIDs[] = $item->virtuemart_product_id;
}

$productModel = VmModel::getModel('Product');
$allProducts = $productModel->getProducts($itemsIDs, false);
$productModel->addImages($allProducts, 1);

foreach($allProducts as $product)
{
print $product->product_sku;
etc...
}


Does anyone have any idea how to add/get manufacturer's logo/image from the database to the object list "$allProducts"?
Yes, I could do something (sql query or whatever...) in the second foreach, however it's a very inefficient way. There must be a better way to do it.

Thanks in advance.
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: balai on December 30, 2013, 10:01:10 AM
Hi

Check the VM manufacturer module
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: ITN on December 31, 2013, 09:49:59 AM
Quote from: balai on December 30, 2013, 10:01:10 AM
Hi

Check the VM manufacturer module

Thanks, but I would like to make it without any additional module.

Any idea why function attachImages($objects,$type,$mime='',$limit=0) doesn't work? It adds image to product, even when I do like that attachImages($objects,'manufacturer');  :o
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: ITN on January 04, 2014, 00:53:02 AM
Anyone?  ???
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: FidelGonzales on January 04, 2014, 07:01:23 AM
ITN: Please provide more details. Which type of page are you referring to? To confirm, are you trying to load the part manufacturer URL and logo onto the page you're referencing?
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: ITN on January 04, 2014, 14:12:30 PM
Quote from: FidelGonzales on January 04, 2014, 07:01:23 AM
ITN: Please provide more details. Which type of page are you referring to? To confirm, are you trying to load the part manufacturer URL and logo onto the page you're referencing?

Function getProducts() gets manufacturer URL as well, but not manufacturer logo. Page doesn't matter, it's just a custom .php file.
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: ITN on January 08, 2014, 17:51:14 PM
So I guess I'm going to hack VM core a little bit...
Any hint on overriding models ?
Title: Re: How to add/get manufacturer's logo to the object list?
Post by: balai on January 09, 2014, 19:20:50 PM
My suggestion was to look into the code of the manufacturer module. Not to use the module itself
The manuf. module uses the VM framework to get the images. Something that can help you a lot