News:

Looking for documentation? Take a look on our wiki

Main Menu

How to add/get manufacturer's logo to the object list?

Started by ITN, December 29, 2013, 16:32:02 PM

Previous topic - Next topic

ITN

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.

balai


ITN

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


FidelGonzales

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?

ITN

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.

ITN

So I guess I'm going to hack VM core a little bit...
Any hint on overriding models ?

balai

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