AbanteCart Community
AbanteCart Development => Extensions and Add-Ons => Topic started by: Bard00k on July 18, 2016, 10:14:55 PM
-
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?
-
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);
-
Hello.
Check this doc for developers http://docs.abantecart.com/pages/developer/architecture.html