static function unassignedProductGroups($_slmaster_id = '') { if (empty($_slmaster_id)) { $current_prod_groups = array(); } else { $cc = new ConstraintChain(); $cc->add(new Constraint('slmaster_id', '=', $_slmaster_id)); $sldiscount = new SLDiscount(); $sldiscount->identifierField = 'prod_group_id'; $sldiscount->orderby = 'prod_group_id'; $current_prod_groups = $sldiscount->getAll($cc); } $cc = new ConstraintChain(); $prodgroup = new STProductgroup(); if (count($current_prod_groups) > 0) { $cc->add(new Constraint($prodgroup->idField, 'not in', '(' . implode(',', $current_prod_groups) . ')')); } return $prodgroup->getAll($cc); }
public function getProductGroups($_slmaster_id = '') { // Used by Ajax to return Email Addresses after selecting the Supplier if (isset($this->_data['ajax'])) { if (!empty($this->_data['slmaster_id'])) { $_slmaster_id = $this->_data['slmaster_id']; } } $prod_groups = SLDiscount::unassignedProductGroups($_slmaster_id); if (isset($this->_data['ajax'])) { $this->view->set('options', $prod_groups); $this->setTemplateName('select_options'); } else { return $prod_groups; } }
function getPriceDiscount($_prod_group_id = '', $_slmaster_id = '') { $_prod_group_id = empty($_prod_group_id) ? $this->product_detail->prod_group_id : $_prod_group_id; if (empty($_slmaster_id) || empty($_prod_group_id)) { return 0; } return SLDiscount::getDiscount($_slmaster_id, $_prod_group_id); }