Addon Question

Greetings everyone,



I am trying to work around an addon to show promo messages on product pages, but I cant seem to find a lot of information on the cs-cart documentations. I have managed to create my addon, set the correct settings etc but I cant seem to find a way to retrieve my addon settings and display it bellow the add to cart button for example.



use Tygh\Settings;
if ( !defined('AREA') ) { die('Access denied'); }
function fn_supplier_message_get_product_data_pre()
{
$addon_settings = Settings::instance()->getValues('supplier_message', 'ADDON');
if(!empty($addon_settings)){
echo $addon_settings[$promotional_message];
}
}
}




I tried retrieve some settings using the above code but seems that doesnt get the addon settings text for some reason.



Any guidance would be highly appreciated.



Thanks in advance.

Hi @MrCodexCY,



Please try
$addon_settings = Registry::get('addons.supplier_message');




I hope that helps,





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

Hello Vali,



Yes that worked perfectly, thank you very much :) Now working on how to position my message under add to cart button…



Cheers!

[quote name=‘MrCodexCY’ timestamp=‘1404815619’ post=‘187147’]

Hello Vali,



Yes that worked perfectly, thank you very much :) Now working on how to position my message under add to cart button…



Cheers!

[/quote]



To use the “buy_now” hook, please create the following file and add button code there:


design/themes/YOUR_THEME/templates/addons/YOUR_ADDON/hooks/products/buy_now.pre.tpl

[quote name=‘eComLabs’ timestamp=‘1404816997’ post=‘187152’]

To use the “buy_now” hook, please create the following file and add button code there:


design/themes/YOUR_THEME/templates/addons/YOUR_ADDON/hooks/products/buy_now.pre.tpl
```<br />
[/quote]<br />
<br />
Working, just had to clear cache <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"> the thing is how am I going to structure the addon folders and zip it? I mean I use the basic template but someone may use antoher template, how will my addon be installed to the default theme folder if in my folder structure I have basic folder name?<br />
<br />
Best Regards.

You put your template files in both basic and responsive theme directories in var/themes_repository/[basic or responsive]/templates/addons/[your_addon_name]/…



The archive should be built to extract your files relative to the root of the store.



When the merchant clicks “Install” on the addons page, the system moves the template files from the var/themes_repository area to all of the existing installed themes. I.e. you don't have to worry about it. Same for css/less files and mail templates too. JS is always in the root and is never theme dependent (not sure why, but that's the way it is).



Do not include any design/themes files in your archive.



Hope this helps.



Might want to move this to the developer's corner section since the general questions area is normally for new users trying to work out how to use the software versus extending it…