yf_shop_basket_clean user module

Fileplugins/shop/modules/shop/yf_shop_basket_clean.class.php
Usemodule('shop_basket_clean'), URL ?object=shop_basket_clean

Public properties

PropertyDefaultDescription
None declared in this class.

Public methods 1

basket_clean

public function basket_clean()

Clean basket contents.

    public function basket_clean()
    {
        $add_sql = "url='" . _es(($_GET['id'] ?? null));
        $sql = 'SELECT * FROM ' . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
        $product_info = db()->query_fetch($sql);
        $_GET['id'] = $product_info['id'];
        $basket = module('shop')->_basket_api()->get_all();
        if ($_GET['id'] && isset($basket[$_GET['id']])) {
            module('shop')->_basket_api()->del($_GET['id']);
        }
        if ( ! ($_GET['id'] ?? null) && isset($basket)) {
            module('shop')->_basket_api()->clean();
        }
        return js_redirect(($_SERVER['HTTP_REFERER'] ?? null), false);
    }