Пример #1
0
    function delattributeoption()
    {
        $jinput = JFactory::getApplication()->input;
        $op_id = $jinput->get('opt_id');
        if (!empty($op_id)) {
            // get attribute id
            $db = JFactory::getDBO();
            $query = 'SELECT itemattribute_id	From `#__kart_itemattributeoptions`
			WHERE `itemattributeoption_id`=' . $op_id;
            $db->setQuery($query);
            $att_id = $db->loadResult();
            // GET ATT OPTION COUNT
            $query = 'SELECT count(*)	From `#__kart_itemattributeoptions`
			WHERE `itemattribute_id`=' . $att_id;
            $db->setQuery($query);
            $count = $db->loadResult();
            $productHelper = new productHelper();
            if ($count == 1) {
                // delete attribute with its option
                $productHelper->delWholeAttribute($att_id);
            } else {
                // DELTE OPTION ONLY
                $productHelper->delWholeAttributeOption($op_id);
            }
        }
    }
Пример #2
0
 function deleteExtraAttributeOptions($att_id, $optionids)
 {
     $productHelper = new productHelper();
     $DbAttoption_list = $productHelper->getAttributeOptionsList($att_id);
     //  ATTRIBUTES HS OPTIONS
     if (!empty($DbAttoption_list)) {
         //  CURRENTLY NO OPIONS
         if (empty($optionids)) {
             $productHelper->delWholeAttribute($att_id);
         } else {
             foreach ($DbAttoption_list as $dbid) {
                 if (!in_array($dbid, $optionids)) {
                     $productHelper->delWholeAttributeOption($dbid);
                 }
             }
         }
     }
 }