Exemplo n.º 1
0
 public function delete($id)
 {
     $data = array();
     $status = Response::STATUS_BAD_REQUEST;
     if (!fn_product_exists($id)) {
         $status = Response::STATUS_NOT_FOUND;
     } elseif (fn_delete_product($id)) {
         $status = Response::STATUS_NO_CONTENT;
     }
     return array('status' => $status, 'data' => $data);
 }
Exemplo n.º 2
0
        $apath = explode('/', $path);
        array_pop($apath);
        $cache[$object_id] = implode('/', $apath);
    }
    return $cache[$object_id];
}, 'parent_type' => 'c', 'name' => 'category', 'picker' => 'pickers/categories/picker.tpl', 'picker_params' => array('multiple' => false, 'use_keys' => 'N'), 'table' => '?:category_descriptions', 'description' => 'category', 'dispatch' => 'categories.view', 'item' => 'category_id', 'condition' => '', 'not_shared' => true, 'tree_options' => array('category', 'category_nohtml'), 'html_options' => array('file', 'category'), 'pager' => true, 'option' => 'seo_category_type', 'exist_function' => function ($category_id) {
    return fn_category_exists($category_id);
}), 'p' => array('tree' => true, 'path_function' => function ($object_id, $company_id = 0) {
    static $cache = array();
    if (!isset($cache[$company_id][$object_id])) {
        $path = db_get_hash_single_array("SELECT c.id_path, p.link_type FROM ?:categories as c LEFT JOIN ?:products_categories as p ON p.category_id = c.category_id WHERE p.product_id = ?i ?p", array('link_type', 'id_path'), $object_id, fn_get_seo_company_condition('c.company_id', '', $company_id));
        $cache[$company_id][$object_id] = !empty($path['M']) ? $path['M'] : $path['A'];
    }
    return $cache[$company_id][$object_id];
}, 'parent_type' => 'c', 'name' => 'product', 'picker' => 'pickers/products/picker.tpl', 'picker_params' => array('type' => 'single', 'view_mode' => 'button'), 'table' => '?:product_descriptions', 'description' => 'product', 'dispatch' => 'products.view', 'item' => 'product_id', 'condition' => '', 'not_shared' => true, 'tree_options' => array('product_category_nohtml', 'product_category'), 'html_options' => array('product_category', 'product_file'), 'option' => 'seo_product_type', 'exist_function' => function ($product_id, $company_id) {
    $result = fn_product_exists($product_id);
    // Check whether product is shared for given company
    if ($result && fn_allowed_for('ULTIMATE')) {
        $result = $result && in_array($company_id, fn_ult_get_shared_product_companies($product_id));
    }
    return $result;
}), 'a' => array('tree' => true, 'path_function' => function ($object_id) {
    static $cache = array();
    if (!isset($cache[$object_id])) {
        $path = db_get_field("SELECT id_path FROM ?:pages WHERE page_id = ?i", $object_id);
        $apath = explode('/', $path);
        array_pop($apath);
        $cache[$object_id] = implode('/', $apath);
    }
    return $cache[$object_id];
}, 'parent_type' => 'a', 'name' => 'page', 'picker' => 'pickers/pages/picker.tpl', 'picker_params' => array('multiple' => false, 'use_keys' => 'N'), 'table' => '?:page_descriptions', 'description' => 'page', 'dispatch' => 'pages.view', 'item' => 'page_id', 'condition' => '', 'tree_options' => array('page', 'page_nohtml'), 'html_options' => array('file', 'page'), 'pager' => true, 'option' => 'seo_page_type', 'exist_function' => function ($page_id) {