<?php require_once '../../functions.php'; $data = $_POST; $resp = new Ajax_Response($data['action'], true); if (!empty($data) && is_array($data)) { $type = new Product_Type($data['product_type']); if ($type instanceof Product_Type) { $data['type_name'] = $type->product_type_slug; $data['action'] = 'add_to_cart'; $data['fields'] = $type->get_product_form_fields($type); $resp->set_status(true); $resp->set_data(array('new_form' => Template_Helper::render_template(__TEMPLATE_PATH__, 'product_choice_form', $data))); } else { $resp->set_message('Could not load fields for ' . ucfirst($type_name) . '. Please try again.'); } } echo $resp->encode_response(); die;
function add_more_price_ranges() { $('#costs_table').append('<tr><td>From: <input type="text" name="cost_qty_start[]" class="formTextDimension" value="" />To: <input type="text" name="cost_qty_end[]" class="formTextDimension" value="" /></td><td>$<input type="text" name="cost_price[]" class="formTextDimension" value=""/></td><td><a href="#" onclick="delete_price_range($(this)); return false;" style="font-size:11px;">Delete cost</a></td></tr>'); } function delete_price_range(delete_link) { delete_link.parent().parent().remove(); } </script> <?php $id = $this->uri->segment(3); $product = ORM::factory('product')->where('products.id', $id)->find(); $product_types = Product_Type::getAll(); $product_costs = Product_Cost::getCostsByProduct($id); $product_tax_classes = Tax::getAll(); $flavors = ORM::factory('flavor')->find_all(); $foil_colors = ORM::factory('foil_color')->find_all(); ?> <form action="<?php echo url::base() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $id; ?> " method="POST" enctype="multipart/form-data" id="form" > <div id="mainContent" >
/** * The function returns current Reference product Type. * * @access public * @return object The Type. */ public function getType() { $Type = new Product_Type(); return $Type->findItem(array('Id = ' . $this->TypeId)); }
/** * The index handler. * * @access public * @return string The HTML code. */ public function index() { $Type = new Product_Type(); $this->getView()->set('Types', $Type->findList(array(), 'Position asc')); return $this->getView()->render(); }