Adapt Your Add-ons and Themes to CS-Cart 4.12.2

Common Changes

The support of PHP 7.4 was added in CS-Cart/Multi-Vendor 4.12.1 and higher.

Core Changes

Changed Functions

  1. // Old:
    \Tygh\Template\Document\Variables\CompanyVariable::__construct($config, $company_id, $lang_code)
    // New:
    \Tygh\Template\Document\Variables\CompanyVariable::__construct($config, $company_id, $lang_code, IContext $context)
    
  2. // Old:
    \Tygh\Template\Document\Order\Context::__construct(Order $order)
    // New:
    \Tygh\Template\Document\Order\Context::__construct(Order $order, $area = AREA)
    
  3. // Old:
    \Tygh\Addons\GiftCertificates\Documents\GiftCertificate\Context::__construct(array $gift_certificate_data, $lang_code)
    // New:
    \Tygh\Addons\GiftCertificates\Documents\GiftCertificate\Context::__construct(array $gift_certificate_data, $lang_code, $area = AREA)
    

Deprecated Functions

  1. // Deprecated function:
    \Tygh\Addons\AdvancedImport\Presets\Manager::updateStatistics
    // What to use instead:
    \Tygh\Addons\AdvancedImport\Presets\Manager::updateState
    

New Functions

  1. Get the site area:

    \Tygh\Template\IContext::getArea()
    
  2. Get the site area:

    \Tygh\Template\Snippet\Table\ItemContext::getArea()
    
  3. Get the site area:

    \Tygh\Template\Mail\Context::getArea()
    
  4. Get the site area:

    \Tygh\Template\Internal\Context::getArea()
    
  5. Get the site area:

    \Tygh\Template\Document\Order\Context::getArea()
    
  6. Get the site area:

    \Tygh\Addons\GiftCertificates\Documents\GiftCertificate\Context::getArea()
    
  7. Gather additional product data for an API request:

    \fn_storefront_rest_api_gather_additional_products_data(array $products, array $params = [])
    
  8. Load seller data for product offers:

    \fn_master_products_load_products_seller_data(array $products)
    

Hook Changes

Changed Hooks

  1. // Old:
    fn_set_hook('template_document_order_context_init', $this, $order);
    // New:
    fn_set_hook('template_document_order_context_init', $this, $order, $area);
    
  2. // Old:
    fn_set_hook('get_logos_post', $company_id, $layout_id, $style_id, $logos);
    // New:
    fn_set_hook('get_logos_post', $company_id, $layout_id, $style_id, $logos, $storefront_id);
    
  3. // Old:
    fn_set_hook('update_language_post', $language_data, $lang_id, $action);
    // New:
    fn_set_hook('update_language_post', $language_data, $lang_id, $action, $previous_language_data);
    

New Hooks

  1. This hook is executed before gathering additional product data for an API request. The hook allows you to modify data gathering parameters:

    fn_set_hook('storefront_rest_api_gather_additional_products_data_pre', $products, $params, $data_gather_params);
    
  2. This hook is executed after gathering additional product data for an API request. The hook allows you to modify gathered data:

    fn_set_hook('storefront_rest_api_gather_additional_products_data_post', $products, $params, $data_gather_params);
    
  3. This hook is executed after logging in. The hook allows you to modify URL redirection and session data:

    fn_set_hook('hybrid_auth_login_post', $user_data, $auth_data, $provider_id, $redirect_url, $user_status);