News:

AbanteCart v1.4.2 is released.

Main Menu

Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Bard00k

#1
Extensions and Add-Ons / Add async javascript tag
August 01, 2016, 10:58:49 PM
There are simple functions in Document class to add JavaScript tag to pages:

$document->addScript("some-script-url");

or

$document->addScriptBottom("some-script-url");

But I see it add scripts as sync, eg without the 'async' attribute.
How can I add a JavaScript tag in AbanteCart with async attribute?

Thanks,
#2
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);
#3
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?
#4
Replying self:

// add new menu item
$rm = new AResourceManager();
$rm->setType('image');

// create resource for the menu icon
$data = array();
$data['resource_code'] = '<i class="fa fa-signal"></i>&nbsp;';
$data['name'] = array($language_id => 'Menu Icon MenuName');
$data['title'] = array($language_id => '');
$data['description'] = array($language_id => '');
$resource_menu_icon_id = $rm->addResource($data);

And then using $resource_menu_icon_id works.
#5
Hello everyone,

I'm trying to build an extension that includes an admin dashboard page and have its own button on the left navbar.
I tried the following code in my installation script (php):


$menu = new AMenu ( "admin" );
$menu->insertMenuItem ( array (  "item_id" => "extension_id",
                   "parent_id" => null,   
                   "item_text" => "Extension Name",
                   "item_url" => "extension_unique_name",
                   "item_type"=>"core",
                   "sort_order"=>"0")
               );

$data = array('language_id' => 0,
'section' => 1,
'block' => 'common/header',
'language_key' => 'extension_id',
'language_value' => 'Extension Name');


And it creates a menu like expected. However, now I want to set an icon instead of the default triangle.
I looked at the code and it expects a 'item_icon_rl_id' key, but I couldn't find in the doc what kind of value this param accept and where can I find a list of possible icon options?

Thanks! :)

Forum Rules Code of conduct
AbanteCart.com 2010 -