public function RecordRepresentationSelection() { $pn_item_id = $this->request->getParameter('item_id', pInteger); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); $pn_selected = $this->request->getParameter('selected', pInteger); $va_errors = array(); $t_order_item = new ca_commerce_order_items($pn_item_id); if (!$t_order_item->getPrimaryKey()) { $va_errors[] = _t("Invalid set item"); } if (!sizeof($va_errors)) { $t_order = new ca_commerce_orders($t_order_item->get('order_id')); if (!$t_order->getPrimaryKey()) { $va_errors[] = _t("Invalid order"); } if (!sizeof($va_errors)) { if ((bool) $pn_selected) { $t_order_item->addRepresentations(array($pn_representation_id)); } else { $t_order_item->removeRepresentations(array($pn_representation_id)); } $va_errors = $t_order_item->getErrors(); } } $this->view->setVar("errors", $va_errors); $this->view->setVar('representation_id', $pn_representation_id); $this->view->setVar('item_id', $pn_item_id); $this->render("ajax_select_representation_json.php"); }