I tried to call my addon by using [url]http://mycscarthost/index.php?dispatch=integration.getallproducts[/url], but I get a 404 page not found. Might it be because it cannot find my addon page, or because I don’t have a template file? How do I achieve what I want? I really don’t want a template file, I just want to return a list of product_code & md5 hash of the concatenated product fields. This allows a remote host to simply get a list of product code and md5’s to compare against for product updates. So all I need returned from this page is an array object.
I’ve created the following directory & files
cscart
—addons
------integration
------addon.xml
------func.php
------init.php
inside the func.php I have the following:
if ( !defined('AREA') ) { die('Access denied'); }
if ($mode == 'getallproducts') {
fn_get_all_products();
}
function fn_get_all_products() {
$product_ids = db_get_fields("SELECT product_id FROM ?:products");
foreach ($product_ids as $product_id) {
$product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, '', true, true, true, true);
$product_code=$product['product_code'];
$product_list[] = array('product_code' => $product_code, 'product_md5' => fn_get_product_md5($product));
return $product_list;
}
}
function fn_get_product_md5($product) {
//this function will concatenate product data and generate an md5
//for now we will just return a number for testing
return 1;
}
?>