AbanteCart Development > Extensions and Add-Ons

Can't get product primary image

(1/1)

Bard00k:
I'm trying to get the primary image URL of a product.
I tried the following code:

$resource = new AResource('image');
$sites = $sizes = array('main'  => array('width'  => 400, 'height' => 400));
$images = $resource->getResourceAllObjects('products', $product['product_id'], null, 1);

But $images is just an empty array.

Any ideas? Or maybe there's a more simple way to get product main image URL?

Bard00k:
Reply to self, this work:

$sizes = array('main'  => array('width'  => $this->baseObject->config->get('config_image_popup_width'),
              'height' => $this->baseObject->config->get('config_image_popup_height')),
              'thumb' => array('width'  => $this->baseObject->config->get('config_image_thumb_width'),
              'height' => $this->baseObject->config->get('config_image_thumb_height')));
         $main_image = $resource->getResourceAllObjects('products', $product_id, $sizes, 1, false);

Basara:
Hello.

Check this doc for developers http://docs.abantecart.com/pages/developer/architecture.html

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod