There are two main folders in cs cart app and design. All php files reside in app folder including xml which is used to create an addon in cs cart. Refer to below steps to create a simple addon in cs cart:
First create a folder "first_addon" for your addon inside app folder and then create a file addon.xml file inside this folder and write some basic statements like addon name, version, priority etc:
id: first_addon
version: 1.0
priority: 1212
position:0
auto_install: MULTIVENDOR,ULTIMATE
Your basic addon is created and now only you need to activate it from admin panel manage addon section.
Further to extend the functionality like modifying some of the functionality using existing hooks, you will need to create two more files inside the "first_addon" folder that is "func.php" and "init.php"
--- init.php ---
if (!defined('BOOTSTRAP')) { die('Access denied'); }
fn_register_hooks(
'get_products'
);
get_products is prebuilt hooks shared by cs cart and using this hook you can modify the query of getting products based on your condition.
----- func.php ------
function fn_first_addon_get_products(&$params, &$fields, &$sortings, &$condition, $join, $sorting, $group_by, $lang_code, $having)
{
//Write you own code to customize the query
$condition .= db_quote(" AND products.company_id IN($effective_companies_str)");
}
Here function name follows some pattern like fn_"your addon name"_get_products this is the way to use hooks in your addon. First register in init.php file and then define function following rules specified above.
This way you can customize already built query or functionality in cs cart without touching core files.