Trying To Create A Select Addon

Im trying to create a select addon where i will have 2 select boxes where one select box will have for options the categories and the other the products for this category my problem is:


  1. is there an ajax call to get the categories from database and products or should i write one?
  2. where should i put my .tpl so i can put my template in the top header?

It is not easy to explain all things to you in one post. Please start from checking official CS-Cart documentation:



http://docs.cs-cart.com/4.3.x/

ok one more question there will be a problem if use angularjs for my addon?

hi


[quote]ok one more question there will be a problem if use angularjs for my addon? [/quote]



difficult to say…

basically in latest version of cs-cart all Javascript objects were put under internal Tygh object and this trick allows to use other jQuery/JS libraries to avoid conflicts.



please try to use it in your module and provide feedback about results here.



best regards,

WSA team

Can someone clarify how can i pass variables to my tpl file i created the frontend controller i can actually call him with with dispatch.

i set Registry::get['view']->assign('categories', $categories).but i cant understand where to put my tpl file so i can get my variables.

my files are :

app/addon/myaddon/addon.xml

app/addon/myaddon/controllers/frontend/myblock.php

design/themes/responsive/templates/addons/myaddon/hooks/blocks/myblock.tpl

nvm i found it i was just tired now i will try to remake it with angularjs.

How can i pass params to my controller iv tried calling url/?dispatch.main&product_id=170 but i keep getting all the products.



my controller:



if ($mode == 'main') {
$params = $_REQUEST;
list($product) = fn_get_products($params);
foreach($product as $products){
foreach($products as $value)
$prod[]=$value;
}
header('Content-Type: application/json');
echo json_encode($prod);
exit;
}

Use the fn_get_product_data function instead of fn_get_products one

i did it with fn_get_products i just passed as params the params['cid'] and sorted ut by category instead…

ok i tried to use angularJs but i cant and i think the problem is that angularJs can only work toghether with jquery 2.1 at least the latest realease of angularjs i will try with some older release and i will get back…