function add_comment_catalog($params) { Common::call_common_instance('catalog'); $catalog = catalog_module_common::getInstance(); $marker = $catalog->obj_tree->ReadNodeParam($params['id'], 'Name'); $this->result["result_code"] = $this->_addcomment(array('CobjectId' => $params['id'], 'tread' => $params['tread'], 'Module' => 'catalog', 'Marker' => $marker), $params['comment']); }
static function getInstance($front_call = null) { if (!self::$instance) { self::$instance = new catalog_module_common($front_call); } return self::$instance; }
function common_call() { $this->_module_name = 'catalog'; $this->_common_obj =& catalog_module_common::getInstance(); //proxy for tree $this->_tree =& $this->_common_obj->obj_tree; $this->_property_tree =& $this->_common_obj->property_tree; $this->_common_obj->set_context(&$this); if (Common::is_module_exists('ishop')) { $this->ishop = true; } }
function catalog_module_front() { global $TMS, $REQUEST_ASSOC; $this->_module_name = 'catalog'; $this->_common_obj =& catalog_module_common::getInstance(true); //true ??? ??? front_call $this->_tree =& $this->_common_obj->obj_tree; $this->_tree->enable_cache(true); $this->context = null; parent::__construct(); if (Common::is_module_exists('ishop')) { $this->ishop = true; } }
function _add($id, $count = 1, $rq_hash = null, $ishop_ext_data = array(), $prevent_rq_hash = null) { $realid = $id; if ($ishop_ext_data['generate_id_from']) { if ($gi = explode(',', $ishop_ext_data['generate_id_from'])) { foreach ($gi as $g) { $g_text .= $ishop_ext_data[$g]; } $id = md5($g_text); } } if ($prevent_rq_hash) { $rq_hash = $_SESSION['siteuser']['cart'][$id]['hash']; } if (isset($_SESSION['siteuser']['cart'][$id]) && $_SESSION['siteuser']['cart'][$id]['hash'] == $rq_hash) { $_SESSION['siteuser']['cart'][$id]['count'] += $count; //меняем хеш для единичного заказа $_SESSION['siteuser']['cart'][$id]['hash'] = Common::GenerateHash(); } elseif (!$_SESSION['siteuser']['cart'][$id]) { $tunes = $this->_common_obj->get_tunes(); Common::call_common_instance('catalog'); $catalog =& catalog_module_common::getInstance(); if ($cat_node = $catalog->obj_tree->getNodeInfo($realid)) { //$props=$catalog->property_set_to_properties($cat_node['params']['Property_set'],$cat_node,'',true,null,0,true); $props = $catalog->property_set_to_properties($cat_node['params']['Property_set'], $cat_node, '', true); $props['props']['__realid'] = $realid; if ($ishop_ext_data['generate_name_from']) { if ($nm = explode(',', $ishop_ext_data['generate_name_from'])) { foreach ($nm as $n) { $name .= $ishop_ext_data[$n] . ' '; } } $props['props'][$tunes['NameProperty']] = $name; } if ($ishop_ext_data['outer_price']) { $props['props'][$tunes['PriceProperty']] = $ishop_ext_data['outer_price']; } if (strpos($props['props'][$tunes['PriceProperty']], ',') or strpos($props['props'][$tunes['PriceProperty']], ' ')) { $props['props'][$tunes['PriceProperty']] = (double) str_replace(array(',', ' '), array('.', ''), $cat_node['params'][$tunes['PriceProperty']]); } else { $props['props'][$tunes['PriceProperty']] = $cat_node['params'][$tunes['PriceProperty']]; } $_SESSION['siteuser']['cart'][$id]['count'] = $count; $_SESSION['siteuser']['cart'][$id]['hash'] = Common::GenerateHash(); $_SESSION['siteuser']['cart'][$id]['ext_data'] = $ishop_ext_data; $_SESSION['siteuser']['cart'][$id]['details'] = $props; } } }
function load_scheme($params) { $this->result['dscheme'] = $this->_common_obj->discount_scheme_tree->GetNodeParam($params['id']); if ($pv = XARRAY::askeyval($this->_common_obj->discount_scheme_tree->GetChildsParam($params['id'], '%', true), 'params')) { Common::call_common_instance('catalog'); $catalog =& catalog_module_common::getInstance(); while (list($k, $p) = each($pv)) { if ($catalog->obj_tree->IsNodeExist($pv[$k]['catid'])) { $catalog->obj_tree->GetFullBonesUp($pv[$k]['catid'], 'id', 'params', 'Name'); $d = XARRAY::arr_to_lev($catalog->obj_tree->FullBonesMas, 'id', 'params', 'Name'); $catalog->obj_tree->FullBonesMas = null; $pv[$k]['Name'] = implode("/", $d); } } $this->result['schemeitems'] = $pv; } }