public function getItems() { require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php'; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php'; $items = parent::getItems(); // TODO: Change the autogenerated stub // Create Money object that represents 1 EUR // Access the Money object's monetary value converted to its base units foreach ($items as &$item) { $item->sale_price_senior = vmprice::get_sale_price_by_mark_up_and_tax($item->price_senior, $item->mark_up_senior, $item->mark_up_price_senior, $item->tax, $item->mark_up_type); $item->sale_price_adult = vmprice::get_sale_price_by_mark_up_and_tax($item->price_adult, $item->mark_up_adult, $item->mark_up_price_adult, $item->tax, $item->mark_up_type); $item->sale_price_teen = vmprice::get_sale_price_by_mark_up_and_tax($item->price_teen, $item->mark_up_teen, $item->mark_up_price_teen, $item->tax, $item->mark_up_type); $item->sale_price_children1 = vmprice::get_sale_price_by_mark_up_and_tax($item->price_children1, $item->mark_up_children1, $item->mark_up_price_children1, $item->tax, $item->mark_up_type); $item->sale_price_children2 = vmprice::get_sale_price_by_mark_up_and_tax($item->price_children2, $item->mark_up_children2, $item->mark_up_price_children2, $item->tax, $item->mark_up_type); $item->sale_price_infant = vmprice::get_sale_price_by_mark_up_and_tax($item->price_infant, $item->mark_up_infant, $item->mark_up_price_infant, $item->tax, $item->mark_up_type); $item->sale_price_private_room = vmprice::get_sale_price_by_mark_up_and_tax($item->price_private_room, $item->mark_up_private_room, $item->mark_up_price_private_room, $item->tax, $item->mark_up_type); $item->sale_price_extra_bed = vmprice::get_sale_price_by_mark_up_and_tax($item->price_extra_bed, $item->mark_up_extra_bed, $item->mark_up_price_extra_bed, $item->tax, $item->mark_up_type); $item->sale_promotion_price_senior = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_senior, $item->mark_up_promotion_senior, $item->mark_up_promotion_price_senior, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_senior, $item->mark_up_promotion_net_senior, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_adult = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_adult, $item->mark_up_promotion_adult, $item->mark_up_promotion_price_adult, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_adult, $item->mark_up_promotion_net_adult, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_teen = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_teen, $item->mark_up_promotion_teen, $item->mark_up_promotion_price_teen, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_teen, $item->mark_up_promotion_net_teen, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_children1 = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_children1, $item->mark_up_promotion_children1, $item->mark_up_promotion_price_children1, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_children1, $item->mark_up_promotion_net_children1, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_children2 = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_children2, $item->mark_up_promotion_children2, $item->mark_up_promotion_price_children2, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_children2, $item->mark_up_promotion_net_children2, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_infant = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_infant, $item->mark_up_promotion_infant, $item->mark_up_promotion_price_infant, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_infant, $item->mark_up_promotion_net_infant, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_private_room = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_private_room, $item->mark_up_promotion_private_room, $item->mark_up_promotion_price_private_room, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_private_room, $item->mark_up_promotion_net_private_room, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->sale_promotion_price_extra_bed = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_extra_bed, $item->mark_up_promotion_extra_bed, $item->mark_up_promotion_price_extra_bed, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_extra_bed, $item->mark_up_promotion_net_extra_bed, $item->mark_up_promotion_net_type, $item->promotion_tax); $item->full_charge_children1 = $item->tsmart_promotion_price_id ? $item->tour_promotion_price_full_charge_children1 : $item->tour_price_full_charge_children1; $item->full_charge_children2 = $item->tsmart_promotion_price_id ? $item->tour_promotion_price_full_charge_children2 : $item->tour_price_full_charge_children2; } return $items; }
function getItemList($search = '') { //echo $this->getListQuery()->dump(); $items = parent::getItems(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php'; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php'; foreach ($items as &$item) { $item->sale_price_adult = vmprice::get_sale_price_by_mark_up_and_tax($item->price_adult, $item->mark_up_adult, $item->mark_up_price_adult, $item->tax, $item->mark_up_type); $item->sale_promotion_price_adult = vmpromotion::get_sale_promotion_price_by_mark_up_and_tax($item->promotion_price_adult, $item->mark_up_promotion_adult, $item->mark_up_promotion_price_adult, $item->mark_up_promotion_type, $item->mark_up_promotion_net_price_adult, $item->mark_up_promotion_net_adult, $item->mark_up_promotion_net_type, $item->promotion_tax); } return $items; }
public function get_list_promotion_price() { $app = JFactory::getApplication(); $input = $app->input; $view =& $this->getView('promotion', 'html', 'tsmartView'); $tsmart_promotion_price_id = $input->get('tsmart_promotion_price_id', 0, 'int'); $model_promotion_price = tmsModel::getModel('promotion'); $model_promotion_price->setId($tsmart_promotion_price_id); $promotion_price = $model_promotion_price->get_promotion_price(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php'; $product = vmpromotion::get_product_by_promotion_price_id($tsmart_promotion_price_id); $tsmart_product_id = $product->tsmart_product_id; $return_item = new stdClass(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php'; $list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($tsmart_product_id); $return_item->list_service_class = $list_service_class; $return_item->promotion_price = $promotion_price; $view->assignRef('promotion_price', $return_item->promotion_price); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php'; $model_product = tmsModel::getModel('product'); $product = $model_product->getItem($tsmart_product_id); $return_item->tour = $product; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php'; $product = vmpromotion::get_product_by_promotion_price_id($tsmart_promotion_price_id); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php'; if ($product->price_type != tsmGroupSize::FLAT_PRICE) { $return_item->list_tour_promotion_price_by_tour_promotion_price_id = vmpromotion::get_list_tour_promotion_price_by_tour_promotion_price_id($tsmart_promotion_price_id); $view->assignRef('list_tour_promotion_price_by_tour_promotion_price_id', $return_item->list_tour_promotion_price_by_tour_promotion_price_id); } else { $return_item->tour_private_price_by_tour_promotion_price_id = vmpromotion::get_list_tour_promotion_price_by_tour_price_id_for_promotion_price($tsmart_promotion_price_id); $view->assignRef('tour_private_price_by_tour_promotion_price_id', $return_item->tour_private_price_by_tour_promotion_price_id); } //get markup $return_item->list_promotion_mark_up = vmpromotion::get_list_mark_up_by_tour_promotion_price_id($tsmart_promotion_price_id); $return_item->list_promotion_mark_up = is_array($return_item->list_promotion_mark_up) ? $return_item->list_promotion_mark_up : array($return_item->list_promotion_mark_up); $return_item->list_promotion_mark_up = JArrayHelper::pivot($return_item->list_promotion_mark_up, 'type'); $view->assignRef('list_promotion_mark_up', $return_item->list_promotion_mark_up); //end get markup //get markup $return_item->list_promotion = vmpromotion::get_list_promotion_by_tour_promotion_price_id($tsmart_promotion_price_id); $return_item->list_promotion = is_array($return_item->list_promotion) ? $return_item->list_promotion : array($return_item->list_promotion); $return_item->list_promotion = JArrayHelper::pivot($return_item->list_promotion, 'type'); $view->assignRef('list_promotion', $return_item->list_promotion); //end get markup require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php'; $return_item->list_group_size_by_tour_id = vmpromotion::get_list_group_size_by_tour_id($tsmart_product_id); $view->assignRef('list_group_size_by_tour_id', $return_item->list_group_size_by_tour_id); ob_start(); $input->set('tpl', 'price'); $view->assignRef('product', $product); $view->display_price(); $price_content = ob_get_contents(); $return_item->price_content = $price_content; ob_end_clean(); // get the callback function echo json_encode($return_item); die; }