/** * add item to cart from db ... * * @return void */ public function dbtocart() { require_once JPATH_SITE . '/components/com_redshop/helpers/cart.php'; $session = JFactory::getSession(); $cart = $session->get('cart'); $user = JFactory::getUser(); if ($user->id && !isset($cart['idx'])) { $rscarthelper = new rsCarthelper(); $rscarthelper->dbtocart(); } }
/** * Display Product add price * * @return void */ public function displayProductaddprice() { ob_clean(); $get = JRequest::get('get'); $producthelper = new producthelper(); $carthelper = new rsCarthelper(); $total_attribute = 0; $product_id = $get['product_id']; $quantity = $get['qunatity']; $data = array(); $data['attribute_data'] = str_replace("::", "##", $get['attribute_data']); $data['property_data'] = str_replace("::", "##", $get['property_data']); $data['subproperty_data'] = str_replace("::", "##", $get['subproperty_data']); $data['accessory_data'] = $get['accessory_data']; $data['acc_quantity_data'] = $get['acc_quantity_data']; $data['acc_attribute_data'] = str_replace("::", "##", $get['acc_attribute_data']); $data['acc_property_data'] = str_replace("::", "##", $get['acc_property_data']); $data['acc_subproperty_data'] = str_replace("::", "##", $get['acc_subproperty_data']); $data['quantity'] = $quantity; $cartdata = $carthelper->generateAttributeArray($data); $retAttArr = $producthelper->makeAttributeCart($cartdata, $product_id, 0, '', $quantity); $ProductPriceArr = $producthelper->getProductNetPrice($product_id, 0, $quantity); $acccartdata = $carthelper->generateAccessoryArray($data); $retAccArr = $producthelper->makeAccessoryCart($acccartdata, $product_id); $accessory_price = $retAccArr[1]; $accessory_vat = $retAccArr[2]; $product_price = ($retAttArr[1] + $retAttArr[2]) * $quantity + $accessory_price + $accessory_vat; $product_main_price = ($retAttArr[1] + $retAttArr[2]) * $quantity + $accessory_price + $accessory_vat; $product_old_price = $ProductPriceArr['product_old_price'] * $quantity; $product_price_saving = $ProductPriceArr['product_price_saving'] * $quantity; $product_discount_price = $ProductPriceArr['product_discount_price'] * $quantity; $product_price_novat = $retAttArr[1] * $quantity + $accessory_price; $product_price_incl_vat = $ProductPriceArr['product_price_incl_vat'] * $quantity + $accessory_price + $accessory_vat; $price_excluding_vat = $retAttArr[1] * $quantity + $accessory_price; $seoProductPrice = $ProductPriceArr['seoProductPrice'] * $quantity; $seoProductSavingPrice = $ProductPriceArr['seoProductSavingPrice'] * $quantity; echo $product_price . ":" . $product_main_price . ":" . $product_old_price . ":" . $product_price_saving . ":" . $product_discount_price . ":" . $product_price_novat . ":" . $product_price_incl_vat . ":" . $price_excluding_vat . ":" . $seoProductPrice . ":" . $seoProductSavingPrice; exit; }
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php'; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $redTemplate = new Redtemplate(); $carthelper = new rsCarthelper(); $user = JFactory::getUser(); $jinput = JFactory::getApplication()->input; $post = $jinput->getArray($_POST); $shippingbox_template = $redTemplate->getTemplate("shipping_box"); if (count($shippingbox_template) > 0 && $shippingbox_template[0]->template_desc) { $box_template_desc = $shippingbox_template[0]->template_desc; } else { $box_template_desc = "<fieldset class=\"adminform\"> <legend><strong>{shipping_box_heading}</strong></legend>\r\n<div>{shipping_box_list}</div>\r\n</fieldset>"; } $shipping_template = $redTemplate->getTemplate("redshop_shipping"); if (count($shipping_template) > 0 && $shipping_template[0]->template_desc) { $template_desc = $shipping_template[0]->template_desc; } else { $template_desc = "<fieldset class=\"adminform\"><legend><strong>{shipping_heading}</strong></legend>\r\n<div>{shipping_method_loop_start}\r\n<h3>{shipping_method_title}</h3>\r\n<div>{shipping_rate_loop_start}\r\n<div>{shipping_rate_name} {shipping_rate}</div>\r\n{shipping_rate_loop_end}</div>\r\n{shipping_method_loop_end}</div>\r\n</fieldset>"; } if ($this->users_info_id > 0) {
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; $url = JURI::base(); $Itemid = JRequest::getInt('Itemid'); $jinput = JFactory::getApplication()->input; $post = $jinput->getArray($_POST); $userhelper = new rsUserhelper(); $rsCarthelper = new rsCarthelper(); $open_to_stretcher = 0; if (isset($post['is_company']) && $post['is_company'] == 1 || DEFAULT_CUSTOMER_REGISTER_TYPE == 2) { $open_to_stretcher = 1; } // Allow registration type settings $allowCustomer = ""; $allowCompany = ""; $showCustomerdesc = ""; $showCompanydesc = "style='display:none;'"; if (ALLOW_CUSTOMER_REGISTER_TYPE == 1) { $allowCompany = "style='display:none;'"; $open_to_stretcher = 0; } elseif (ALLOW_CUSTOMER_REGISTER_TYPE == 2) { $allowCustomer = "style='display:none;'"; $showCustomerdesc = "style='display:none;'";
public function store($data) { $extra_field = new extra_field(); $quotationHelper = new quotationHelper(); $producthelper = new producthelper(); $rsCarthelper = new rsCarthelper(); $stockroomhelper = new rsstockroomhelper(); $extra_field->extra_field_save($data, 16, $data['user_info_id'], $data['user_email']); $row = $this->getTable('quotation_detail'); if ($data['quotation_discount'] > 0) { $data['order_total'] = $data['order_total'] - $data['quotation_discount'] - $data['order_total'] * $data['quotation_special_discount'] / 100; } $data['quotation_number'] = $quotationHelper->generateQuotationNumber(); $data['quotation_encrkey'] = $quotationHelper->randomQuotationEncrkey(); $data['quotation_cdate'] = time(); $data['quotation_mdate'] = time(); $data['quotation_total'] = $data['order_total']; $data['quotation_subtotal'] = $data['order_subtotal']; $data['quotation_tax'] = $data['order_tax']; $data['quotation_ipaddress'] = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown'; if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } $row->quotation_status = 2; if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } $quotation_item = array(); $user_id = $row->user_id; $item = $data['order_item']; for ($i = 0; $i < count($item); $i++) { $product_id = $item[$i]->product_id; $quantity = $item[$i]->quantity; $product_excl_price = $item[$i]->prdexclprice; $product_price = $item[$i]->productprice; // Attribute price added $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id); $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity); $product_attribute = $retAttArr[0]; // Accessory price $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id); $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id); $product_accessory = $retAccArr[0]; $wrapper_price = 0; $wrapper_vat = 0; $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data); if (count($wrapper) > 0) { if ($wrapper[0]->wrapper_price > 0) { $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id); } $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat; } $rowitem =& $this->getTable('quotation_item_detail'); $product = $producthelper->getProductById($product_id); $quotation_item[$i]->quotation_id = $row->quotation_id; $quotation_item[$i]->product_id = $product_id; $quotation_item[$i]->is_giftcard = 0; $quotation_item[$i]->product_name = $product->product_name; $quotation_item[$i]->actualitem_price = $product_price; $quotation_item[$i]->product_price = $product_price; $quotation_item[$i]->product_excl_price = $product_excl_price; $quotation_item[$i]->product_final_price = $product_price * $quantity; $quotation_item[$i]->product_attribute = $product_attribute; $quotation_item[$i]->product_accessory = $product_accessory; $quotation_item[$i]->product_wrapperid = $item[$i]->wrapper_data; $quotation_item[$i]->wrapper_price = $wrapper_price; $quotation_item[$i]->product_quantity = $quantity; if (!$rowitem->bind($quotation_item[$i])) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$rowitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // Store userfields $userfields = JRequest::getVar('extrafields' . $product_id); $userfields_id = JRequest::getVar('extrafields_id_' . $product_id); for ($ui = 0; $ui < count($userfields); $ui++) { $quotationHelper->insertQuotationUserfield($userfields_id[$ui], $rowitem->quotation_item_id, 12, $userfields[$ui]); } /** my accessory save in table start */ if (count($generateAccessoryCart) > 0) { $attArr = $generateAccessoryCart; for ($a = 0; $a < count($attArr); $a++) { $accessory_vat_price = 0; $accessory_attribute = ""; $accessory_id = $attArr[$a]['accessory_id']; $accessory_name = $attArr[$a]['accessory_name']; $accessory_price = $attArr[$a]['accessory_price']; $accessory_org_price = $accessory_price; if ($accessory_price > 0) { $accessory_vat_price = $producthelper->getProductTax($rowitem->product_id, $accessory_price, $user_id); } $attchildArr = $attArr[$a]['accessory_childs']; for ($j = 0; $j < count($attchildArr); $j++) { $attribute_id = $attchildArr[$j]['attribute_id']; $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>"; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $accessory_id; $rowattitem->section_name = $attchildArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 1; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attchildArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>"; $subpropArr = $propArr[$k]['property_childs']; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 1; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>"; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 1; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } $accdata =& $this->getTable('accessory_detail'); if ($accessory_id > 0) { $accdata->load($accessory_id); } $accProductinfo = $producthelper->getProductById($accdata->child_product_id); $rowaccitem =& $this->getTable('quotation_accessory_item'); $rowaccitem->quotation_item_acc_id = 0; $rowaccitem->quotation_item_id = $rowitem->quotation_item_id; $rowaccitem->accessory_id = $accessory_id; $rowaccitem->accessory_item_sku = $accProductinfo->product_number; $rowaccitem->accessory_item_name = $accessory_name; $rowaccitem->accessory_price = $accessory_org_price; $rowaccitem->accessory_vat = $accessory_vat_price; $rowaccitem->accessory_quantity = $rowitem->product_quantity; $rowaccitem->accessory_item_price = $accessory_price; $rowaccitem->accessory_final_price = $accessory_price * $rowitem->product_quantity; $rowaccitem->accessory_attribute = $accessory_attribute; if ($accessory_id > 0) { if (!$rowaccitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } /** my attribute save in table start */ if (count($generateAttributeCart) > 0) { $attArr = $generateAttributeCart; for ($j = 0; $j < count($attArr); $j++) { $attribute_id = $attArr[$j]['attribute_id']; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $rowitem->product_id; $rowattitem->section_name = $attArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 0; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; /** product property STOCKROOM update start */ $stockroomhelper->updateStockroomQuantity($property_id, $rowitem->product_quantity, "property"); $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 0; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $subpropArr = $propArr[$k]['property_childs']; for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; /** product subproperty STOCKROOM update start */ $stockroomhelper->updateStockroomQuantity($subproperty_id, $rowitem->product_quantity, "subproperty"); $rowattitem = $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $rowitem->quotation_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 0; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } } } return $row; }
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; require_once JPATH_COMPONENT . '/helpers/product.php'; include_once JPATH_COMPONENT . '/helpers/helper.php'; include_once JPATH_COMPONENT . '/helpers/cart.php'; $carthelper = new rsCarthelper(); $redconfig = new Redconfiguration(); $configobj = new Redconfiguration(); $redTemplate = new Redtemplate(); $producthelper = new producthelper(); $order_functions = new order_functions(); $redhelper = new redhelper(); $db = JFactory::getDbo(); $url = JURI::base(); $Itemid = $redhelper->getCheckoutItemid(); $order_id = JRequest::getInt('oid'); // For barcode $model = $this->getModel('order_detail'); $order = $this->OrdersDetail; $thankyou_text = str_replace('{order_number}', $order->order_number, ORDER_RECEIPT_INTROTEXT); if ($this->params->get('show_page_title', 1)) { ?>
defined('_JEXEC') or die; $uri = JURI::getInstance(); $url = JURI::base(); $redconfig = new Redconfiguration(); $extra_field = new extra_field(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php'; require_once JPATH_COMPONENT . '/helpers/product.php'; require_once JPATH_COMPONENT . '/helpers/helper.php'; require_once JPATH_COMPONENT . '/helpers/cart.php'; $producthelper = new producthelper(); $redhelper = new redhelper(); $order_functions = new order_functions(); $redTemplate = new Redtemplate(); $shippinghelper = new shipping(); $carthelper = new rsCarthelper(); $Itemid = JRequest::getInt('Itemid'); $oid = JRequest::getInt('oid'); $print = JRequest::getInt('print'); $getshm = $uri->getScheme(); $config = JFactory::getConfig(); $force_ssl = $config->getValue('force_ssl'); if ($getshm == 'https' && $force_ssl > 2) { $uri->setScheme('http'); } ?> <script type="text/javascript"> function submitReorder() { if (!confirm("<?php echo JText::_('COM_REDSHOP_CONFIRM_CART_EMPTY'); ?>
*/ defined('_JEXEC') or die; $url = JURI::base(); include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/quotation.php'; include_once JPATH_COMPONENT . '/helpers/product.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extra_field.php'; require_once JPATH_COMPONENT . '/helpers/extra_field.php'; $producthelper = new producthelper(); $quotationHelper = new quotationHelper(); $order_functions = new order_functions(); $configobj = new Redconfiguration(); $redTemplate = new Redtemplate(); $extra_field = new extra_field(); $extraField = new extraField(); $carthelper = new rsCarthelper(); $user = JFactory::getUser(); $Itemid = JRequest::getInt('Itemid'); $app = JFactory::getApplication(); $params = $app->getParams('com_redshop'); $returnitemid = $params->get('logout', $Itemid); $accountbillto_link = JRoute::_("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid); $accountshipto_link = JRoute::_("index.php?option=com_redshop&view=account_shipto&Itemid=" . $Itemid); $logout_link = JRoute::_("index.php?option=com_redshop&view=login&task=logout&logout=" . $returnitemid . "&Itemid=" . $Itemid); $compare_link = JRoute::_("index.php?option=com_redshop&view=product&layout=compare&Itemid=" . $Itemid); $mytags_link = JRoute::_("index.php?option=com_redshop&view=account&layout=mytags&Itemid=" . $Itemid); $wishlist_link = JRoute::_("index.php?option=com_redshop&view=wishlist&task=viewwishlist&Itemid=" . $Itemid); $model = $this->getModel('account'); $template = $redTemplate->getTemplate("account_template"); if (count($template) > 0 && $template[0]->template_desc != "") { $template_desc = $template[0]->template_desc;
* @package RedSHOP.Backend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); require_once JPATH_COMPONENT_SITE . '/helpers/product.php'; require_once JPATH_COMPONENT_SITE . '/helpers/helper.php'; require_once JPATH_COMPONENT_SITE . '/helpers/cart.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php'; $producthelper = new producthelper(); $carthelper = new rsCarthelper(); $order_functions = new order_functions(); $redhelper = new redhelper(); $extra_field = new extra_field(); $shippinghelper = new shipping(); $config = new Redconfiguration(); $uri = JURI::getInstance(); $url = $uri->root(); $option = JRequest::getVar('option'); $tmpl = JRequest::getVar('tmpl'); $model = $this->getModel('order_detail'); $session = JFactory::getSession(); $billing = $this->billing; $shipping = $this->shipping; $is_company = $billing->is_company; $order_id = $this->detail->order_id;
* @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; include_once JPATH_COMPONENT . '/helpers/helper.php'; include_once JPATH_COMPONENT . '/helpers/product.php'; include_once JPATH_COMPONENT . '/helpers/cart.php'; $adminpath = JPATH_ADMINISTRATOR . '/components/com_redshop'; include_once $adminpath . '/helpers/shipping.php'; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $dispatcher = JDispatcher::getInstance(); $producthelper = new producthelper(); $objshipping = new shipping(); $redhelper = new redhelper(); $carthelper = new rsCarthelper(); $redTemplate = new Redtemplate(); $url = JURI::base(); $cart = $this->cart; $idx = $cart['idx']; $model = $this->getModel('cart'); $session = JFactory::getSession(); $user = JFactory::getUser(); $print = JRequest::getInt('print'); $Itemid = $redhelper->getCheckoutItemid(); // Define array to store product detail for ajax cart display $cart_data = $this->data[0]->template_desc; // Process the product plugin before cart template replace tag JPluginHelper::importPlugin('redshop_product'); $results = $dispatcher->trigger('onStartCartTemplateReplace', array(&$cart_data, $cart)); // End
/** * @package RedSHOP.Backend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); require_once JPATH_COMPONENT_SITE . '/helpers/product.php'; $producthelper = new producthelper(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; $order_functions = new order_functions(); $shippinghelper = new shipping(); $carthelper = new rsCarthelper(); $mypost = JRequest::getVar('cid'); $mysplit = preg_split(",", $mypost); $mycnt = ''; for ($k = 0; $k < count($mysplit); $k++) { $replace = ''; if ($mysplit[$k] != '') { $mycnt = count($mysplit); //exit; //echo $mypost;exit; $option = JRequest::getVar('option'); $config = new Redconfiguration(); $model = $this->getModel('order_detail'); $extra_field = new extra_field(); $uri = JURI::getInstance(); $url = $uri->root();
public function createMultiprintInvoicePdf($oid) { require_once JPATH_SITE . '/components/com_redshop/helpers/tcpdf/config/lang/eng.php'; require_once JPATH_SITE . '/components/com_redshop/helpers/tcpdf/tcpdf.php'; $order_functions = new order_functions(); $shippinghelper = new shipping(); $carthelper = new rsCarthelper(); $extra_field = new extra_field(); $redconfig = new Redconfiguration(); $redTemplate = new Redtemplate(); $producthelper = new producthelper(); $message = ""; $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false); $pdfObj->SetTitle('Shipped'); $pdfObj->SetAuthor('redSHOP'); $pdfObj->SetCreator('redSHOP'); $pdfObj->SetMargins(8, 8, 8); // Changed font to support Unicode Characters - Specially Polish Characters $font = 'freeserif'; $pdfObj->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdfObj->setHeaderFont(array($font, '', 8)); // Set font $pdfObj->SetFont($font, "", 6); $order_id = ""; for ($o = 0; $o < count($oid); $o++) { $body = ""; $message = ""; $order_id = $oid[$o]; $OrderProducts = $order_functions->getOrderItemDetail($order_id); $OrdersDetail = $order_functions->getmultiOrderDetails($order_id); $billing = $order_functions->getOrderBillingUserInfo($OrdersDetail[0]->order_id); $shipping = $order_functions->getOrderShippingUserInfo($OrdersDetail[0]->order_id); $is_company = $billing->is_company; if (!$shipping) { $shipping = $billing; } $paymentmethod = $order_functions->getOrderPaymentDetail($order_id); $paymentmethod = $paymentmethod[0]; $order_print_template = $redTemplate->getTemplate("order_print"); if (count($order_print_template) > 0 && $order_print_template[0]->template_desc != "") { $ordersprint_template = $order_print_template[0]->template_desc; } else { $ordersprint_template = '<table style="width: 100%;" border="0" cellpadding="5" cellspacing="0"> <tbody><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody> <tr style="background-color: #cccccc;"><th align="left">{order_information_lbl}{print}</th></tr><tr></tr ><tr><td>{order_id_lbl} : {order_id}</td></tr><tr><td>{order_number_lbl} : {order_number}</td></tr><tr> <td>{order_date_lbl} : {order_date}</td></tr><tr><td>{order_status_lbl} : {order_status}</td></tr><tr> <td>{shipping_method_lbl} : {shipping_method} : {shipping_rate_name}</td></tr><tr><td>{payment_lbl} : {payment_method}</td> </tr></tbody></table></td></tr><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"> <tbody><tr style="background-color: #cccccc;"><th align="left">{billing_address_information_lbl}</th> </tr><tr></tr><tr><td>{billing_address}</td></tr></tbody></table></td></tr><tr><td colspan="2"> <table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"><tbody><tr style="background-color: #cccccc;"> <th align="left">{shipping_address_info_lbl}</th></tr><tr></tr><tr><td>{shipping_address}</td></tr></tbody> </table></td></tr><tr><td colspan="2"><table style="width: 100%;" border="0" cellpadding="2" cellspacing="0"> <tbody><tr style="background-color: #cccccc;"><th align="left">{order_detail_lbl}</th></tr><tr></tr><tr><td> <table style="width: 100%;" border="0" cellpadding="2" cellspacing="2"><tbody><tr><td>{product_name_lbl}</td><td>{note_lbl}</td> <td>{price_lbl}</td><td>{quantity_lbl}</td><td align="right">Total Price</td></tr>{product_loop_start}<tr> <td><p>{product_name}<br />{product_attribute}{product_accessory}{product_userfields}</p></td> <td>{product_wrapper}{product_thumb_image}</td><td>{product_price}</td><td>{product_quantity}</td> <td align="right">{product_total_price}</td></tr>{product_loop_end}</tbody></table></td></tr><tr> <td></td></tr><tr><td><table style="width: 100%;" border="0" cellpadding="2" cellspacing="2"><tbody> <tr align="left"><td align="left"><strong>{order_subtotal_lbl} : </strong></td><td align="right">{order_subtotal}</td> </tr>{if vat}<tr align="left"><td align="left"><strong>{vat_lbl} : </strong></td><td align="right">{order_tax}</td> </tr>{vat end if}{if discount}<tr align="left"><td align="left"><strong>{discount_lbl} : </strong></td> <td align="right">{order_discount}</td></tr>{discount end if}<tr align="left"><td align="left"> <strong>{shipping_lbl} : </strong></td><td align="right">{order_shipping}</td></tr><tr align="left"> <td colspan="2" align="left"><hr /></td></tr><tr align="left"><td align="left"><strong>{total_lbl} :</strong> </td><td align="right">{order_total}</td></tr><tr align="left"><td colspan="2" align="left"><hr /><br /> <hr /></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>'; } $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT') . "'>" . "<img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT') . "' title='" . JText::_('COM_REDSHOP_PRINT') . "' /></a>"; $search[] = "{print}"; $replace[] = $print_tag; $search[] = "{order_id}"; $replace[] = $OrdersDetail[0]->order_id; $search[] = "{order_number}"; $replace[] = $OrdersDetail[0]->order_number; $search[] = "{order_date}"; $replace[] = $redconfig->convertDateFormat($OrdersDetail[0]->cdate); $search[] = "{customer_note}"; $replace[] = $OrdersDetail[0]->customer_note; // Set order paymethod name $search[] = "{payment_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_PAYMENT_METHOD'); $search[] = "{payment_method}"; $replace[] = $paymentmethod->order_payment_name; $statustext = $order_functions->getOrderStatusTitle($OrdersDetail[0]->order_status); $issplit = $OrdersDetail[0]->split_payment; $search[] = "{order_status}"; if (trim($OrdersDetail[0]->order_payment_status) == 'Paid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_PAID'); } elseif (trim($OrdersDetail[0]->order_payment_status) == 'Unpaid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_UNPAID'); } elseif (trim($OrdersDetail[0]->order_payment_status) == 'Partial Paid') { $orderPaymentStatus = JText::_('COM_REDSHOP_PAYMENT_STA_PARTIAL_PAID'); } else { $orderPaymentStatus = $OrdersDetail[0]->order_payment_status; } $replace[] = $statustext . " - " . $orderPaymentStatus; $search[] = "{order_status_order_only}"; $replace[] = $statustext; $search[] = "{order_status_payment_only}"; $replace[] = $orderPaymentStatus; $search[] = "{customer_note_lbl}"; $replace[] = JText::_('COM_REDSHOP_COMMENT'); $search[] = "{customer_note}"; $replace[] = $OrdersDetail->customer_note; $search[] = "{shipping_method_lbl}"; $replace[] = JText::_('COM_REDSHOP_SHIPPING_METHOD_LBL'); $shipping_method = ''; $shipping_rate_name = ''; if ($OrdersDetail[0]->ship_method_id != '') { $ship_method = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $OrdersDetail[0]->ship_method_id))); if (count($ship_method) <= 1) { $ship_method = explode("|", $OrdersDetail[0]->ship_method_id); } $shipping_method = ""; $shipping_rate_name = ""; if (count($ship_method) > 0) { if (array_key_exists(1, $ship_method)) { $shipping_method = $ship_method[1]; } if (array_key_exists(2, $ship_method)) { $shipping_rate_name = $ship_method[2]; } } } $search[] = "{shipping_method}"; $replace[] = $shipping_method; $search[] = "{shipping}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_shipping); $search[] = "{shipping_rate_name}"; $replace[] = $shipping_rate_name; $ordersprint_template = $carthelper->replaceBillingAddress($ordersprint_template, $billing); $ordersprint_template = $carthelper->replaceShippingAddress($ordersprint_template, $shipping); $product_name = ""; $product_note = ""; $product_price = ""; $product_quantity = ""; $product_total_price = ""; $template_start = ""; $template_middle = ""; $template_end = ""; if (strstr($ordersprint_template, "{product_loop_start}")) { $template_sdata = explode('{product_loop_start}', $ordersprint_template); $template_start = $template_sdata[0]; $template_edata = explode('{product_loop_end}', $template_sdata[1]); $template_end = $template_edata[1]; $template_middle = $template_edata[0]; } $cart_tr = ''; for ($i = 0; $i < count($OrderProducts); $i++) { $wrapper_name = ""; if ($OrderProducts[$i]->wrapper_id) { $wrapper = $producthelper->getWrapper($OrderProducts[$i]->product_id, $OrderProducts[$i]->wrapper_id); if (count($wrapper) > 0) { $wrapper_name = JText::_('COM_REDSHOP_WRAPPER') . ":<br/>" . $wrapper[0]->wrapper_name . "(" . $producthelper->getProductFormattedPrice($OrderProducts[$i]->wrapper_price) . ")"; } } if ($OrderProducts[$i]->is_giftcard == 1) { $product_userfields = $producthelper->getuserfield($OrderProducts[$i]->order_item_id, 13); } else { $product_userfields = $producthelper->getuserfield($OrderProducts[$i]->order_item_id); } $product_name = "<div class='product_name'>" . $OrderProducts[$i]->order_item_name . "</div>"; $product = $producthelper->getProductById($OrderProducts[$i]->product_id); $product_number = $OrderProducts[$i]->order_item_sku; $product_note = "<div class='product_note'>" . $wrapper_name . "</div>"; $product_total_price = "<div class='product_total_price'>" . $producthelper->getProductFormattedPrice($OrderProducts[$i]->product_final_price) . "</div>"; $product_price = "<div class='product_price'>" . $producthelper->getProductFormattedPrice($OrderProducts[$i]->product_item_price) . "</div>"; $product_quantity = '<div class="product_quantity">' . $OrderProducts[$i]->product_quantity . '</div>'; $cart_mdata = ''; $uri = JURI::getInstance(); $url = $uri->root(); if ($product->product_full_image) { if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_full_image)) { $product_image_path = $product->product_full_image; } else { if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) { $product_image_path = PRODUCT_DEFAULT_IMAGE; } else { $product_image_path = ""; } } } else { if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) { $product_image_path = PRODUCT_DEFAULT_IMAGE; } else { $product_image_path = ""; } } if ($product_image_path) { $thumbUrl = RedShopHelperImages::getImagePath($product_image_path, '', 'thumb', 'product', CART_THUMB_WIDTH, CART_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING); $product_image = '<div class="product_image"><img src="' . $thumbUrl . '"></div>'; } else { $product_image = "<div class='product_image'></div>"; } $cart_mdata = str_replace("{product_name}", $product_name, $template_middle); $cart_mdata = str_replace("{product_thumb_image}", $product_image, $cart_mdata); $cart_mdata = str_replace("{product_attribute}", $OrderProducts[$i]->product_attribute, $cart_mdata); $cart_mdata = str_replace("{product_accessory}", $OrderProducts[$i]->product_accessory, $cart_mdata); $cart_mdata = str_replace("{product_wrapper}", '', $cart_mdata); $cart_mdata = str_replace("{product_number}", $product_number, $cart_mdata); $cart_mdata = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $cart_mdata); $user_subscribe_detail = $producthelper->getUserProductSubscriptionDetail($OrderProducts[$i]->order_item_id); if (count($user_subscribe_detail) > 0 && $user_subscribe_detail->subscription_id) { $subscription_detail = $producthelper->getProductSubscriptionDetail($OrderProducts[$i]->product_id, $user_subscribe_detail->subscription_id); $selected_subscription = $subscription_detail->subscription_period . " " . $subscription_detail->period_type; $cart_mdata = str_replace("{product_subscription_lbl}", JText::_('COM_REDSHOP_SUBSCRIPTION'), $cart_mdata); $cart_mdata = str_replace("{product_subscription}", $selected_subscription, $cart_mdata); } else { $cart_mdata = str_replace("{product_subscription_lbl}", "", $cart_mdata); $cart_mdata = str_replace("{product_subscription}", "", $cart_mdata); } $cart_mdata = str_replace("{product_userfields}", $product_userfields, $cart_mdata); $cart_mdata = str_replace("{product_wrapper}", $product_note, $cart_mdata); $cart_mdata = str_replace("{product_price}", $product_price, $cart_mdata); $cart_mdata = str_replace("{product_quantity}", $product_quantity, $cart_mdata); $cart_mdata = str_replace("{product_total_price}", $product_total_price, $cart_mdata); $cart_tr .= $cart_mdata; } $ordersprint_template = $template_start . $cart_tr . $template_end; $search[] = "{order_subtotal}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_subtotal); if ($OrdersDetail[0]->order_tax <= 0) { $template_vat_sdata = explode('{if vat}', $ordersprint_template); $template_vat_start = $template_vat_sdata[0]; $template_vat_edata = explode('{vat end if}', $template_vat_sdata[1]); $template_vat_end = $template_vat_edata[1]; $template_vat_middle = $template_vat_edata[0]; $ordersprint_template = $template_vat_start . $template_vat_end; } else { $search[] = "{if vat}"; $replace[] = ''; $search[] = "{order_tax}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_tax); $search[] = "{tax}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_tax); $search[] = "{vat_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_TAX'); $search[] = "{vat end if}"; $replace[] = ''; } if ($OrdersDetail[0]->payment_discount <= 0) { if (strstr($ordersprint_template, "{if payment_discount}")) { $template_pd_sdata = explode('{if payment_discount}', $ordersprint_template); $template_pd_start = $template_pd_sdata[0]; $template_pd_edata = explode('{payment_discount end if}', $template_pd_sdata[1]); $template_pd_end = $template_pd_edata[1]; $template_pd_middle = $template_pd_edata[0]; $ordersprint_template = $template_pd_start . $template_pd_end; } } else { $OrdersDetail->order_discount = $OrdersDetail[0]->order_discount - $OrdersDetail[0]->payment_discount; $search[] = "{if payment_discount}"; $replace[] = ''; $search[] = "{payment_order_discount}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->payment_discount); $search[] = "{payment_discount_lbl}"; $replace[] = JText::_('COM_REDSHOP_PAYMENT_DISCOUNT_LBL'); $search[] = "{payment_discount end if}"; $replace[] = ''; } if ($OrdersDetail->order_discount <= 0) { if (strstr($ordersprint_template, "{if discount}")) { $template_discount_sdata = explode('{if discount}', $ordersprint_template); $template_discount_start = $template_discount_sdata[0]; $template_discount_edata = explode('{discount end if}', $template_discount_sdata[1]); $template_discount_end = $template_discount_edata[1]; $template_discount_middle = $template_discount_edata[0]; $ordersprint_template = $template_discount_start . $template_discount_end; } } else { $search[] = "{if discount}"; $replace[] = ''; $search[] = "{order_discount}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_discount); $search[] = "{discount_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_DISCOUNT'); $search[] = "{discount end if}"; $replace[] = ''; } $search[] = "{order_id_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_ID'); $search[] = "{order_number_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_NUMBER'); $search[] = "{order_date_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_DATE'); $search[] = "{order_status_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_STATUS'); $search[] = "{shipping_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_SHIPPING'); $search[] = "{order_information_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_INFORMATION'); $search[] = "{billing_address_information_lbl}"; $replace[] = JText::_('COM_REDSHOP_BILLING_ADDRESS_INFORMATION'); $search[] = "{shipping_address_info_lbl}"; $replace[] = JText::_('COM_REDSHOP_SHIPPING_ADDRESS_INFORMATION'); $search[] = "{order_detail_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_DETAILS'); $search[] = "{product_name_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRODUCT_NAME'); $search[] = "{note_lbl}"; $replace[] = JText::_('COM_REDSHOP_NOTE'); $search[] = "{price_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRICE'); $search[] = "{quantity_lbl}"; $replace[] = JText::_('COM_REDSHOP_QUANTITY'); $search[] = "{total_price_lbl}"; $replace[] = JText::_('COM_REDSHOP_TOTAL_PRICE'); $search[] = "{order_subtotal_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_SUBTOTAL'); $search[] = "{product_number_lbl}"; $replace[] = JText::_('COM_REDSHOP_PRODUCT_NUMBER'); $search[] = "{total_lbl}"; $replace[] = JText::_('COM_REDSHOP_ORDER_TOTAL'); $search[] = "{order_shipping}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_shipping); $search[] = "{shipping}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_shipping); $search[] = "{order_total}"; $replace[] = $producthelper->getProductFormattedPrice($OrdersDetail[0]->order_total); $message = str_replace($search, $replace, $ordersprint_template); $search = ""; $replace = ""; $body = $message; $pdfObj->AddPage(); $pdfObj->WriteHTML($body, true, false, true, false, ''); } $invoice_pdfName = "multiprintorder"; $pdfObj->Output(JPATH_SITE . '/components/com_redshop/assets/document/invoice/' . $invoice_pdfName . ".pdf", "F"); return $invoice_pdfName; }
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; $rsCarthelper = new rsCarthelper(); $url = JURI::base(); // Check that we need to use discount calculator // Default calculation method $calcMethod = $this->data->discount_calc_method; // Default calculation unit // Calculation prices as per various area $discount_calc_data = $rsCarthelper->getDiscountCalcData(0, $this->data->product_id); // Calculation UNIT $calcoption = array(); $calcoption[] = JHTML::_('select.option', 'mm', JText::_('COM_REDSHOP_MILLIMETER')); $calcoption[] = JHTML::_('select.option', 'cm', JText::_('COM_REDSHOP_CENTIMETER')); $calcoption[] = JHTML::_('select.option', 'm', JText::_('COM_REDSHOP_METER')); $discount_calc_unit = JHTML::_('select.genericlist', $calcoption, 'discount_calc_unit', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_VOLUME_UNIT); unset($calcoption); $height = "<tr><td><label>" . JText::_('COM_REDSHOP_HEIGHT') . "</label></td><td><input type='text' name='calc_height' id='calc_height' value='' /></td></tr>"; $width = "<tr><td><label>" . JText::_('COM_REDSHOP_WIDTH') . "</label></td><td><input type='text' name='calc_width' id='calc_width' value='' /></td></tr>"; $depth = "<tr><td><label>" . JText::_('COM_REDSHOP_LENGTH') . "</label></td><td><input type='text' name='calc_depth' id='calc_depth' value='' /></td></tr>"; $radius = "<tr><td><label>" . JText::_('COM_REDSHOP_RADIUS') . "</label></td><td><input type='text' name='calc_radius' id='calc_radius' value='' /></td></tr>"; $calculate = "<tr><td> </td><td>"; $calculate .= '<input type="button" name="calc_calculate" id="calc_calculate" onclick="discountCalculation(\'' . $this->pid . '\')" value="' . JText::_('COM_REDSHOP_CALCULATE') . '" /></td></tr>';
{ op.style.setAttribute("filter", "alpha(opacity=30);"); } } </script> <?php $url = JURI::base(); $user = JFactory::getUser(); JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; include_once JPATH_COMPONENT . '/helpers/product.php'; include_once JPATH_COMPONENT . '/helpers/cart.php'; include_once JPATH_COMPONENT . '/helpers/user.php'; include_once JPATH_COMPONENT . '/helpers/helper.php'; $carthelper = new rsCarthelper(); $producthelper = new producthelper(); $order_functions = new order_functions(); $redhelper = new redhelper(); $userhelper = new rsUserhelper(); $redTemplate = new Redtemplate(); $dispatcher = JDispatcher::getInstance(); $user = JFactory::getUser(); $session = JFactory::getSession(); $cart = $session->get('cart'); $user_id = $user->id; // Get redshop helper $Itemid = $redhelper->getCheckoutItemid(); if ($Itemid == 0) { $Itemid = JRequest::getInt('Itemid'); }
public function createShippedInvoicePdf($order_id) { $redconfig = new Redconfiguration(); $producthelper = new producthelper(); $extra_field = new extra_field(); $config = JFactory::getConfig(); $redTemplate = new Redtemplate(); $carthelper = new rsCarthelper(); $redshopMail = new redshopMail(); $message = ""; $subject = ""; $cart = ''; $arr_discount_type = array(); $mailinfo = $redTemplate->getTemplate("shippment_invoice_template"); if (count($mailinfo) > 0) { $message = $mailinfo[0]->template_desc; } else { return false; } $row = $this->getOrderDetails($order_id); $barcode_code = $row->barcode; $arr_discount = explode('@', $row->discount_type); $discount_type = ''; for ($d = 0; $d < count($arr_discount); $d++) { if ($arr_discount[$d]) { $arr_discount_type = explode(':', $arr_discount[$d]); if ($arr_discount_type[0] == 'c') { $discount_type .= JText::_('COM_REDSHOP_COUPON_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } if ($arr_discount_type[0] == 'v') { $discount_type .= JText::_('COM_REDSHOP_VOUCHER_CODE') . ' : ' . $arr_discount_type[1] . '<br>'; } } } if (!$discount_type) { $discount_type = JText::_('COM_REDSHOP_NO_DISCOUNT_AVAILABLE'); } $search[] = "{discount_type}"; $replace[] = $discount_type; $message = str_replace($search, $replace, $message); $message = $redshopMail->imginmail($message); $user = JFactory::getUser(); $billingaddresses = $this->getOrderBillingUserInfo($order_id); $email = $billingaddresses->user_email; $userfullname = $billingaddresses->firstname . " " . $billingaddresses->lastname; $message = $carthelper->replaceOrderTemplate($row, $message); echo "<div id='redshopcomponent' class='redshop'>"; if (strstr($message, "{barcode}")) { $img_url = REDSHOP_FRONT_IMAGES_RELPATH . "barcode/" . $barcode_code . ".png"; if (function_exists("curl_init")) { $bar_codeIMG = '<img src="' . $img_url . '" alt="Barcode" border="0" />'; $message = str_replace("{barcode}", $bar_codeIMG, $message); } } $body = $message; return $body; }
public function neworderitem($data, $quantity, $order_item_id) { $adminproducthelper = new adminproducthelper(); $producthelper = new producthelper(); $rsCarthelper = new rsCarthelper(); $stockroomhelper = new rsstockroomhelper(); // Get Order Info $orderdata = $this->getTable('order_detail'); $orderdata->load($this->_id); $item = $data['order_item']; // Get product Info // Set Order Item Info $orderitemdata = $this->getTable('order_item_detail'); $orderitemdata->load($order_item_id); $user_id = $orderdata->user_id; for ($i = 0; $i < count($item); $i++) { $product_id = $item[$i]->product_id; $product_excl_price = $item[$i]->prdexclprice; $product_price = $item[$i]->productprice; // Attribute price added $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id); $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity); $product_attribute = $retAttArr[0]; // Accessory price $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id); $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id); $product_accessory = $retAccArr[0]; $wrapper_price = 0; $wrapper_vat = 0; if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') { $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data); if (count($wrapper) > 0) { if ($wrapper[0]->wrapper_price > 0) { $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id); } $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat; } } $product = $producthelper->getProductById($product_id); $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity); $stockroom_id_list = $updatestock['stockroom_list']; $stockroom_quantity_list = $updatestock['stockroom_quantity_list']; $orderitemdata->stockroom_id = $stockroom_id_list; $orderitemdata->stockroom_quantity = $stockroom_quantity_list; $orderitemdata->order_item_id = 0; $orderitemdata->order_id = $this->_id; $orderitemdata->user_info_id = $orderdata->user_info_id; $orderitemdata->supplier_id = $product->manufacturer_id; $orderitemdata->product_id = $product_id; $orderitemdata->order_item_sku = $product->product_number; $orderitemdata->order_item_name = $product->product_name; $orderitemdata->product_quantity = $quantity; $orderitemdata->product_item_price = $product_price; $orderitemdata->product_item_price_excl_vat = $product_excl_price; $orderitemdata->product_final_price = $product_price * $quantity; $orderitemdata->order_item_currency = REDCURRENCY_SYMBOL; $orderitemdata->order_status = "P"; $orderitemdata->cdate = time(); $orderitemdata->mdate = time(); $orderitemdata->product_attribute = $product_attribute; $orderitemdata->product_accessory = $product_accessory; $orderitemdata->wrapper_id = $item[$i]->wrapper_data; $orderitemdata->wrapper_price = $wrapper_price; if ($producthelper->checkProductDownload($product_id)) { $medianame = $producthelper->getProductMediaName($product_id); for ($j = 0; $j < count($medianame); $j++) { $sql = "INSERT INTO " . $this->_table_prefix . "product_download " . "(product_id, user_id, order_id, end_date, download_max, download_id, file_name) " . "VALUES('" . $product_id . "', '" . $user_id . "', '" . $this->_id . "', " . "'" . (time() + PRODUCT_DOWNLOAD_DAYS * 23 * 59 * 59) . "', '" . PRODUCT_DOWNLOAD_LIMIT . "', " . "'" . md5(uniqid(mt_rand(), true)) . "', '" . $medianame[$j]->media_name . "')"; $this->_db->setQuery($sql); $this->_db->query(); } } if (!$orderitemdata->store()) { $this->setError($this->_db->getErrorMsg()); return false; } /** my accessory save in table start */ if (count($generateAccessoryCart) > 0) { $attArr = $generateAccessoryCart; for ($a = 0; $a < count($attArr); $a++) { $accessory_vat_price = 0; $accessory_attribute = ""; $accessory_id = $attArr[$a]['accessory_id']; $accessory_name = $attArr[$a]['accessory_name']; $accessory_price = $attArr[$a]['accessory_price']; $accessory_org_price = $accessory_price; if ($accessory_price > 0) { $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id); } $attchildArr = $attArr[$a]['accessory_childs']; for ($j = 0; $j < count($attchildArr); $j++) { $attribute_id = $attchildArr[$j]['attribute_id']; $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>"; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $accessory_id; $rowattitem->section_name = $attchildArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 1; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attchildArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>"; $subpropArr = $propArr[$k]['property_childs']; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 1; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>"; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 1; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } $accdata =& $this->getTable('accessory_detail'); if ($accessory_id > 0) { $accdata->load($accessory_id); } $accessoryproduct = $producthelper->getProductById($accdata->child_product_id); $rowaccitem =& $this->getTable('order_acc_item'); $rowaccitem->order_item_acc_id = 0; $rowaccitem->order_item_id = $orderitemdata->order_item_id; $rowaccitem->product_id = $accessory_id; $rowaccitem->order_acc_item_sku = $accessoryproduct->product_number; $rowaccitem->order_acc_item_name = $accessory_name; $rowaccitem->order_acc_price = $accessory_org_price; $rowaccitem->order_acc_vat = $accessory_vat_price; $rowaccitem->product_quantity = $quantity; $rowaccitem->product_acc_item_price = $accessory_price; $rowaccitem->product_acc_final_price = $accessory_price * $quantity; $rowaccitem->product_attribute = $accessory_attribute; if ($accessory_id > 0) { if (!$rowaccitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } /** my attribute save in table start */ if (count($generateAttributeCart) > 0) { $attArr = $generateAttributeCart; for ($j = 0; $j < count($attArr); $j++) { $attribute_id = $attArr[$j]['attribute_id']; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $product_id; $rowattitem->section_name = $attArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 0; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $usre_id); } $property_id = $propArr[$k]['property_id']; /** product property STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property"); $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 0; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $subpropArr = $propArr[$k]['property_childs']; for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; /** product subproperty STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty"); $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $orderitemdata->order_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 0; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } } if (USE_CONTAINER) { $producthelper->updateContainerStock($product_id, $quantity, $orderitemdata->container_id); } // Store userfields $userfields = $item[$i]->extrafieldname; $userfields_id = $item[$i]->extrafieldId; for ($ui = 0; $ui < count($userfields); $ui++) { $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $orderitemdata->order_item_id, 12, $userfields[$ui]); } } if ($orderitemdata->order_item_id > 0) { $totalItemVat = $orderitemdata->product_item_price - $orderitemdata->product_item_price_excl_vat; $orderdata->order_tax = $orderdata->order_tax + $totalItemVat * $orderitemdata->product_quantity; $orderdata->order_total = $orderdata->order_total + $orderitemdata->product_final_price; $orderdata->order_subtotal = $orderdata->order_subtotal + $orderitemdata->product_final_price; $orderdata->mdate = time(); // Update order detail if (!$orderdata->store()) { return false; } if (ECONOMIC_INTEGRATION == 1) { $economic = new economic(); $invoiceHandle = $economic->renewInvoiceInEconomic($orderdata); } // Send mail from template $redshopMail = new redshopMail(); $redshopMail->sendOrderSpecialDiscountMail($this->_id); } else { return false; } return true; }
/** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $url = JURI::base(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; $order_function = new order_functions(); $redconfig = new Redconfiguration(); $producthelper = new producthelper(); $carthelper = new rsCarthelper(); $Itemid = JRequest::getInt('Itemid'); $print = JRequest::getInt('print'); $document = JFactory::getDocument(); $redTemplate = new Redtemplate(); $template_id = $this->params->get('template_id'); $orderslist_template = $redTemplate->getTemplate("order_list", $template_id); if (count($orderslist_template) > 0 && $orderslist_template[0]->template_desc != "") { $template_desc = $orderslist_template[0]->template_desc; } else { $template_desc = "<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\" width=\"100%\">\r\n<tbody>\r\n<tr>\r\n<th>{order_id_lbl}</th> <th>{product_name_lbl}</th> <th>{total_price_lbl}</th> <th>{order_date_lbl}</th> <th>{order_date_lbl}</th> <th>{order_detail_lbl}</th>\r\n</tr>\r\n{product_loop_start} \r\n<tr>\r\n<td>{order_id}</td>\r\n<td>{order_products}</td>\r\n<td>{order_total}</td>\r\n<td>{order_date}</td>\r\n<td>{order_status}</td>\r\n<td>{order_detail_link}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n<div>{pagination}</div>"; } if ($this->params->get('show_page_heading', 1)) { ?> <div class="componentheading<?php echo $this->params->get('pageclass_sfx');
* * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; $url = JURI::base(); $user = JFactory::getUser(); $app = JFactory::getApplication(); JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php'; require_once JPATH_COMPONENT . '/helpers/product.php'; require_once JPATH_COMPONENT . '/helpers/cart.php'; require_once JPATH_COMPONENT . '/helpers/helper.php'; $carthelper = new rsCarthelper(); $producthelper = new producthelper(); $order_functions = new order_functions(); $redhelper = new redhelper(); $redTemplate = new Redtemplate(); $shippinghelper = new shipping(); $session = JFactory::getSession(); $document = JFactory::getDocument(); // Get redshop helper $Itemid = $redhelper->getCheckoutItemid(); $model = $this->getModel('checkout'); $cart = $session->get('cart'); JHTML::Script('credit_card.js', 'components/com_redshop/assets/js/', false); $billingaddresses = $model->billingaddresses(); if (!count($billingaddresses)) { $msg = JText::_('COM_REDSHOP_LOGIN_USER_IS_NOT_REDSHOP_USER');
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; JHTML::_('behavior.tooltip'); $redTemplate = new Redtemplate(); $carthelper = new rsCarthelper(); $Itemid = JRequest::getInt('Itemid'); $return = JRequest::getString('return'); $session = JFactory::getSession(); $cart = $session->get('cart'); $detail = $this->detail; $user = JFactory::getUser(); $extra_field = new extra_field(); $quotation_template = $redTemplate->getTemplate("quotation_request"); if (count($quotation_template) > 0 && $quotation_template[0]->template_desc != "") { $template_desc = $quotation_template[0]->template_desc; } else { $template_desc = "<fieldset class=\"adminform\"><legend>{order_detail_lbl}</legend> \r\n<table class=\"admintable\">\r\n<tbody>\r\n<tr>\r\n<td>{product_name_lbl}</td>\r\n<td>{quantity_lbl}</td>\r\n</tr>\r\n{product_loop_start}\r\n<tr>\r\n<td>{product_name}<br />{product_attribute}<br />{product_accessory}<br />{product_userfields}</td>\r\n<td>{update_cart}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n</fieldset>\r\n<p>{customer_note_lbl}:{customer_note}</p>\r\n<fieldset class=\"adminform\"><legend>{billing_address_information_lbl}</legend> {billing_address}{quotation_custom_field_list} </fieldset> \r\n<table border=\"0\">\r\n<tbody>\r\n<tr>\r\n<td align=\"center\">{cancel_btn}{request_quotation_btn}</td>\r\n</tr>\r\n</tbody>\r\n</table>"; } ?> <script type="text/javascript"> function validateInfo() { var frm = document.adminForm;
/** * Display Credit Card * * @return void */ public function displaycreditcard() { $carthelper = new rsCarthelper(); $get = JRequest::get('get'); $creditcard = ""; $payment_method_id = $get['payment_method_id']; if ($payment_method_id != "") { $creditcard = $carthelper->replaceCreditCardInformation($payment_method_id); } $creditcard = '<div id="creditcardinfo">' . $creditcard . '</div>'; echo $creditcard; die; }
/** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; /* * Include required files */ include_once JPATH_COMPONENT . '/helpers/product.php'; include_once JPATH_COMPONENT . '/helpers/cart.php'; $producthelper = new producthelper(); $carthelper = new rsCarthelper(); $redTemplate = new Redtemplate(); $cart = $this->cart; $idx = $cart['idx']; $Itemid = JRequest::getInt('Itemid'); $cart_index = JRequest::getInt('cart_index'); $product_id = JRequest::getInt('pid'); $model = $this->getModel('cart'); $session = JFactory::getSession(); $user = JFactory::getUser(); $document = JFactory::getDocument(); JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false); JHTML::Script('common.js', 'components/com_redshop/assets/js/', false); ?> <script type="text/javascript"> function cancelForm(frm) {
<div class="mod_cart_total" id="mod_cart_total"> <?php switch ($output_view) { case 'simple': if ($count) { $output = '<div class="mod_cart_extend_total_pro_value" id="mod_cart_total_txt_product" >'; $output .= JText::_('COM_REDSHOP_TOTAL_PRODUCT') . ':' . ' ' . $cartTotalProduct . ' ' . JText::_('COM_REDSHOP_PRODUCTS_IN_CART'); $output .= '</div>'; } break; case 'extended': $output = '<div class="mod_cart_products" id="mod_cart_products">'; if ($count) { $cartTotalProduct = $idx; for ($i = 0; $i < $idx; $i++) { $carthelper = new rsCarthelper(); if ($carthelper->rs_multi_array_key_exists('giftcard_id', $cart[$i]) && $cart[$i]['giftcard_id']) { $giftcardData = $producthelper->getGiftcardData($cart[$i]['giftcard_id']); $name = $giftcardData->giftcard_name; } else { $product_detail = $producthelper->getProductById($cart[$i]['product_id']); $name = $product_detail->product_name; } $output .= '<div class="mod_cart_product">'; $output .= '<div class="mod_cart_product_name">' . $name . ' x ' . $cart[$i]['quantity'] . '</div>'; if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) { $output .= '<div class="mod_cart_product_price">'; if ($show_with_vat) { $output .= $producthelper->getProductFormattedPrice($cart[$i]['product_price'], true); } else { $output .= $producthelper->getProductFormattedPrice($cart[$i]['product_price_excl_vat'], true);
public function store($postdata) { $redshopMail = new redshopMail(); $order_functions = new order_functions(); $helper = new redhelper(); $producthelper = new producthelper(); $rsCarthelper = new rsCarthelper(); $shippinghelper = new shipping(); $adminproducthelper = new adminproducthelper(); $stockroomhelper = new rsstockroomhelper(); // For barcode generation $barcode_code = $order_functions->barcode_randon_number(12, 0); $postdata['barcode'] = $barcode_code; $row = $this->getTable('order_detail'); if (!$row->bind($postdata)) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } $iscrm = $helper->isredCRM(); if ($iscrm) { $postdata['order_id'] = $row->order_id; $postdata['debitor_id'] = $postdata['user_info_id']; JTable::addIncludePath(REDCRM_ADMIN . '/tables'); $crmorder =& $this->getTable('crm_order'); if (!$crmorder->bind($postdata)) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$crmorder->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // Update rma table entry if (ENABLE_RMA && isset($postdata['rmanotes'])) { $rmaInfo = $this->getTable('rma_orders'); $rmaInfo->rma_number = $postdata['rma_number']; $rmaInfo->original_order_id = $postdata['main_order_id']; $rmaInfo->credit_note_order_id = $row->order_id; $rmaInfo->rma_note = $postdata['rmanotes']; $rmaInfo->store(); } JTable::addIncludePath(REDSHOP_ADMIN . '/tables'); } $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $row->ship_method_id))); $rowOrderStatus =& $this->getTable('order_status_log'); $rowOrderStatus->order_id = $row->order_id; $rowOrderStatus->order_status = $row->order_status; $rowOrderStatus->date_changed = time(); $rowOrderStatus->customer_note = $row->customer_note; $rowOrderStatus->store(); $billingaddresses = $order_functions->getBillingAddress($row->user_id); if (isset($postdata['billisship']) && $postdata['billisship'] == 1) { $shippingaddresses = $billingaddresses; } else { $key = 0; $shippingaddresses = $order_functions->getShippingAddress($row->user_id); $shipp_users_info_id = isset($postdata['shipp_users_info_id']) && $postdata['shipp_users_info_id'] != 0 ? $postdata['shipp_users_info_id'] : 0; if ($shipp_users_info_id != 0) { for ($o = 0; $o < count($shippingaddresses); $o++) { if ($shippingaddresses[$o]->users_info_id == $shipp_users_info_id) { $key = $o; break; } } } $shippingaddresses = $shippingaddresses[$key]; } // ORDER DELIVERY TIME IS REMAINING $user_id = $row->user_id; $item = $postdata['order_item']; for ($i = 0; $i < count($item); $i++) { $product_id = $item[$i]->product_id; $quantity = $item[$i]->quantity; $product_excl_price = $item[$i]->prdexclprice; $product_price = $item[$i]->productprice; // Attribute price added $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id); $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity); $product_attribute = $retAttArr[0]; // Accessory price $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id); $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id); $product_accessory = $retAccArr[0]; $accessory_total_price = $retAccArr[1]; $accessory_vat_price = $retAccArr[2]; $wrapper_price = 0; $wrapper_vat = 0; if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') { $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data); if (count($wrapper) > 0) { if ($wrapper[0]->wrapper_price > 0) { $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id); } $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat; } } $product = $producthelper->getProductById($product_id); $rowitem =& $this->getTable('order_item_detail'); if (!$rowitem->bind($postdata)) { $this->setError($this->_db->getErrorMsg()); return false; } // STOCKROOM update $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity); $stockroom_id_list = $updatestock['stockroom_list']; $stockroom_quantity_list = $updatestock['stockroom_quantity_list']; $rowitem->stockroom_id = $stockroom_id_list; $rowitem->stockroom_quantity = $stockroom_quantity_list; $rowitem->order_item_id = 0; $rowitem->order_id = $row->order_id; $rowitem->user_info_id = $row->user_info_id; $rowitem->supplier_id = $product->manufacturer_id; $rowitem->product_id = $product_id; $rowitem->order_item_sku = $product->product_number; $rowitem->order_item_name = $product->product_name; $rowitem->product_quantity = $quantity; $rowitem->product_item_price = $product_price; $rowitem->product_item_price_excl_vat = $product_excl_price; $rowitem->product_final_price = $product_price * $quantity; $rowitem->order_item_currency = REDCURRENCY_SYMBOL; $rowitem->order_status = $row->order_status; $rowitem->cdate = $row->cdate; $rowitem->mdate = $row->cdate; $rowitem->product_attribute = $product_attribute; $rowitem->product_accessory = $product_accessory; $rowitem->wrapper_id = $item[$i]->wrapper_data; $rowitem->wrapper_price = $wrapper_price; $rowitem->is_giftcard = 0; // RedCRM product purchase price if ($iscrm) { $crmProductHelper = new crmProductHelper(); $crmproduct = $crmProductHelper->getProductById($product_id); $rowitem->product_purchase_price = $crmproduct->product_purchase_price > 0 ? $crmproduct->product_purchase_price : $crmproduct->product_price; } if ($producthelper->checkProductDownload($product_id)) { $medianame = $producthelper->getProductMediaName($product_id); for ($j = 0; $j < count($medianame); $j++) { $product_serial_number = $producthelper->getProdcutSerialNumber($product_id); $producthelper->insertProductDownload($product_id, $user_id, $rowitem->order_id, $medianame[$j]->media_name, $product_serial_number->serial_number); } } if (!$rowitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } /** my accessory save in table start */ if (count($generateAccessoryCart) > 0) { $attArr = $generateAccessoryCart; for ($a = 0; $a < count($attArr); $a++) { $accessory_vat_price = 0; $accessory_attribute = ""; $accessory_id = $attArr[$a]['accessory_id']; $accessory_name = $attArr[$a]['accessory_name']; $accessory_price = $attArr[$a]['accessory_price']; $accessory_org_price = $accessory_price; if ($accessory_price > 0) { $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id); } $attchildArr = $attArr[$a]['accessory_childs']; for ($j = 0; $j < count($attchildArr); $j++) { $attribute_id = $attchildArr[$j]['attribute_id']; $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>"; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $accessory_id; $rowattitem->section_name = $attchildArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 1; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attchildArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>"; $subpropArr = $propArr[$k]['property_childs']; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 1; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>"; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 1; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } $accdata =& $this->getTable('accessory_detail'); if ($accessory_id > 0) { $accdata->load($accessory_id); } $accProductinfo = $producthelper->getProductById($accdata->child_product_id); $rowaccitem =& $this->getTable('order_acc_item'); $rowaccitem->order_item_acc_id = 0; $rowaccitem->order_item_id = $rowitem->order_item_id; $rowaccitem->product_id = $accessory_id; $rowaccitem->order_acc_item_sku = $accProductinfo->product_number; $rowaccitem->order_acc_item_name = $accessory_name; $rowaccitem->order_acc_price = $accessory_org_price; $rowaccitem->order_acc_vat = $accessory_vat_price; $rowaccitem->product_quantity = $quantity; $rowaccitem->product_acc_item_price = $accessory_price; $rowaccitem->product_acc_final_price = $accessory_price * $quantity; $rowaccitem->product_attribute = $accessory_attribute; if ($accessory_id > 0) { if (!$rowaccitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } /** my attribute save in table start */ if (count($generateAttributeCart) > 0) { $attArr = $generateAttributeCart; for ($j = 0; $j < count($attArr); $j++) { $attribute_id = $attArr[$j]['attribute_id']; $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $rowitem->product_id; $rowattitem->section_name = $attArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 0; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; /** product property STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property"); $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 0; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $subpropArr = $propArr[$k]['property_childs']; for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; /** product subproperty STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty"); $rowattitem =& $this->getTable('order_attribute_item'); $rowattitem->order_att_item_id = 0; $rowattitem->order_item_id = $rowitem->order_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 0; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } } // $producthelper->insertProdcutUserfield($i,$item,$rowitem->order_item_id,12); if (USE_CONTAINER) { $producthelper->updateContainerStock($product_id, $quantity, $rowitem->container_id); } // Store userfields $userfields = $item[$i]->extrafieldname; $userfields_id = $item[$i]->extrafieldId; for ($ui = 0; $ui < count($userfields); $ui++) { $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $rowitem->order_item_id, 12, $userfields[$ui]); } // redCRM RMA Transaction Entry if ($iscrm) { if (ENABLE_RMA && $rowitem->product_final_price < 0) { // RMA transation log if (isset($item[$i]->reason)) { $rmaTrans =& $this->getTable('rma_transaction'); $rmaTrans->rma_transaction_id = 0; $rmaTrans->rma_number = $postdata['rma_number']; $rmaTrans->order_item_return_id = $rowitem->order_item_id; $rmaTrans->order_item_return_reason = $item[$i]->reason; $rmaTrans->order_item_return_status = $item[$i]->deposition; $rmaTrans->order_item_return_action = $item[$i]->action; $rmaTrans->cdate = time(); $rmaTrans->store(); if (ENABLE_ITEM_TRACKING_SYSTEM) { // Manage supplier order stock $crmSupplierOrderHelper = new crmSupplierOrderHelper(); $senddata['main_order_number'] = $postdata['main_order_number']; $senddata['order_status'] = $row->order_status; $senddata['product_id'] = $rowitem->product_id; $senddata['property_id'] = $property_id; $senddata['subproperty_id'] = $subproperty_id; $senddata['deposition'] = $item[$i]->deposition; $itemqty = $rowitem->product_quantity; for ($r = 0; $r < $itemqty; $r++) { $crmSupplierOrderHelper->manageStockAffectedRMA($senddata); } } } } } } $rowpayment =& $this->getTable('order_payment'); if (!$rowpayment->bind($postdata)) { $this->setError($this->_db->getErrorMsg()); return false; } $rowpayment->order_id = $row->order_id; $rowpayment->payment_method_id = $postdata['payment_method_class']; $rowpayment->order_payment_amount = $row->order_total; $rowpayment->order_payment_name = $postdata['order_payment_name']; $rowpayment->payment_method_class = $postdata['payment_method_class']; if (!$rowpayment->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // Add billing Info $userrow =& $this->getTable('user_detail'); $userrow->load($billingaddresses->users_info_id); $orderuserrow =& $this->getTable('order_user_detail'); if (!$orderuserrow->bind($userrow)) { $this->setError($this->_db->getErrorMsg()); return false; } $orderuserrow->order_id = $row->order_id; $orderuserrow->address_type = 'BT'; if (!$orderuserrow->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // Add shipping Info $userrow =& $this->getTable('user_detail'); if (isset($shippingaddresses->users_info_id)) { $userrow->load($shippingaddresses->users_info_id); } $orderuserrow =& $this->getTable('order_user_detail'); if (!$orderuserrow->bind($userrow)) { $this->setError($this->_db->getErrorMsg()); return false; } $orderuserrow->order_id = $row->order_id; $orderuserrow->address_type = 'ST'; if (!$orderuserrow->store()) { $this->setError($this->_db->getErrorMsg()); return false; } if ($row->order_status == CLICKATELL_ORDER_STATUS) { $helper->clickatellSMS($row->order_id); } // Maintan supplier order stck when item tracking system is enabled if ($helper->isredCRM()) { if (ENABLE_ITEM_TRACKING_SYSTEM) { // Supplier order helper object $crmSupplierOrderHelper = new crmSupplierOrderHelper(); $getStatus = array(); $getStatus['orderstatus'] = $row->order_status; $getStatus['paymentstatus'] = $row->order_payment_status; $crmSupplierOrderHelper->redSHOPOrderUpdate($row->order_id, $getStatus); unset($getStatus); } } $checkOrderStatus = 1; if ($postdata['payment_method_class'] == "rs_payment_banktransfer" || $postdata['payment_method_class'] == "rs_payment_banktransfer_discount" || $postdata['payment_method_class'] == "rs_payment_banktransfer2" || $postdata['payment_method_class'] == "rs_payment_banktransfer3" || $postdata['payment_method_class'] == "rs_payment_banktransfer4" || $postdata['payment_method_class'] == "rs_payment_banktransfer5") { $checkOrderStatus = 0; } // Economic Integration start for invoice generate and book current invoice if (ECONOMIC_INTEGRATION == 1 && ECONOMIC_INVOICE_DRAFT != 2) { $issplit = 0; $economic = new economic(); if (isset($postdata['issplit']) && $postdata['issplit'] == 1) { $issplit = 1; } $economicdata['split_payment'] = $issplit; $economicdata['economic_payment_terms_id'] = $postdata['economic_payment_terms_id']; $economicdata['economic_design_layout'] = $postdata['economic_design_layout']; $economicdata['economic_is_creditcard'] = $postdata['economic_is_creditcard']; $payment_name = $postdata['payment_method_class']; $paymentArr = explode("rs_payment_", $postdata['payment_method_class']); if (count($paymentArr) > 0) { $payment_name = $paymentArr[1]; } $economicdata['economic_payment_method'] = $payment_name; $invoiceHandle = $economic->createInvoiceInEconomic($row->order_id, $economicdata); if (ECONOMIC_INVOICE_DRAFT == 0) { $bookinvoicepdf = $economic->bookInvoiceInEconomic($row->order_id, $checkOrderStatus); if (is_file($bookinvoicepdf)) { $ret = $redshopMail->sendEconomicBookInvoiceMail($row->order_id, $bookinvoicepdf); } } } // ORDER MAIL SEND if ($postdata['task'] != "save_without_sendmail") { $redshopMail->sendOrderMail($row->order_id); } return $row; }
* * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die('restricted access'); $url = JURI::base(); $user = JFactory::getUser(); $request = JRequest::get(); JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php'; include_once JPATH_COMPONENT_SITE . '/helpers/product.php'; include_once JPATH_COMPONENT_SITE . '/helpers/cart.php'; include_once JPATH_COMPONENT_SITE . '/helpers/user.php'; include_once JPATH_COMPONENT_SITE . '/helpers/helper.php'; $carthelper = new rsCarthelper(); $producthelper = new producthelper(); $order_functions = new order_functions(); $redhelper = new redhelper(); $userhelper = new rsUserhelper(); $user = JFactory::getUser(); $session = JFactory::getSession(); $user_id = $user->id; // get redshop helper $Itemid = $redhelper->getCheckoutItemid(); if ($Itemid == 0) { $Itemid = JRequest::getVar('Itemid'); } $option = JRequest::getVar('option'); $model = $this->getModel('checkout'); $ccinfo = JRequest::getVar('ccinfo');
public function modifyQuotation($user_id = 0) { $session = JFactory::getSession(); $carthelper = new rsCarthelper(); $cart = $session->get('cart'); $cart = $carthelper->modifyCart($cart, $user_id); $session->set('cart', $cart); $carthelper->cartFinalCalculation(false); }
<?php /** * @package RedSHOP.Frontend * @subpackage Template * * @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; JHTML::_('behavior.tooltip'); JHTMLBehavior::modal(); $redTemplate = new Redtemplate(); $carthelper = new rsCarthelper(); $model = $this->getModel('checkout'); $payment_template = $redTemplate->getTemplate("redshop_payment"); if (count($payment_template) > 0 && $payment_template[0]->template_desc) { $template_desc = $payment_template[0]->template_desc; } else { $template_desc = "<fieldset class=\"adminform\"><legend><strong>{payment_heading}</strong></legend><div>{split_payment}</div>\r\n<div>{payment_loop_start}\r\n<div>{payment_method_name}</div>\r\n<div>{creditcard_information}</div>\r\n{payment_loop_end}</div></fieldset>"; } // Get billing info for check is_company $billingaddresses = $model->billingaddresses(); $is_company = $billingaddresses->is_company; if ((int) $billingaddresses->ean_number == 0) { $ean_number = 1; } $template_desc = $carthelper->replacePaymentTemplate($template_desc, $this->element, $is_company, $ean_number); $template_desc = $redTemplate->parseredSHOPplugin($template_desc); echo eval("?>" . $template_desc . "<?php ");
function display($tpl = null) { $config = new Redconfiguration(); $redTemplate = new Redtemplate(); $order_functions = new order_functions(); $producthelper = new producthelper(); $model = $this->getModel(); $redTemplate = new Redtemplate(); $detail = $this->get('data'); $carthelper = new rsCarthelper(); $shippinghelper = new shipping(); $products = $order_functions->getOrderItemDetail($detail->order_id); $template = $model->getStockNoteTemplate(); if (count($template) > 0 && $template->template_desc != "") { $html_template = $template->template_desc; } else { $html_template = '<table border="0" cellspacing="2" cellpadding="2" width="100%"><tr><td>{order_id_lbl} : {order_id}</td><td> {order_date_lbl} : {order_date}</td></tr></table> <table border="1" cellspacing="0" cellpadding="0" width="100%"><tbody><tr style="background-color: #d7d7d4"><th align="center">{product_name_lbl}</th> <th align="center">{product_number_lbl}</th> <th align="center">{product_quantity_lbl}</th></tr> {product_loop_start} <tr> <td align="center"> <table> <tr><td>{product_name}</td></tr> <tr><td>{product_attribute}</td></tr> </table> </td> <td align="center">{product_number}</td> <td align="center">{product_quantity}</td> </tr> {product_loop_end} </tbody> </table>'; } ob_start(); if (strstr($html_template, "{product_loop_start}") && strstr($html_template, "{product_loop_end}")) { $template_sdata = explode('{product_loop_start}', $html_template); $template_start = $template_sdata[0]; $template_edata = explode('{product_loop_end}', $template_sdata[1]); $template_end = $template_edata[1]; $template_middle = $template_edata[0]; $middle_data = ''; for ($p = 0; $p < count($products); $p++) { $middle_data .= $template_middle; $product_detail = $producthelper->getProductById($products[$p]->product_id); $middle_data = str_replace("{product_number}", $product_detail->product_number, $middle_data); $middle_data = str_replace("{product_name}", $products[$p]->order_item_name, $middle_data); $middle_data = str_replace("{product_attribute}", $products[$p]->product_attribute, $middle_data); $middle_data = str_replace("{product_quantity}", $products[$p]->product_quantity, $middle_data); } $html_template = $template_start . $middle_data . $template_end; } $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template); $html_template = str_replace("{order_id}", $detail->order_id, $html_template); $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template); $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template); $html_template = str_replace("{product_name_lbl}", JText::_('COM_REDSHOP_PRODUCT_NAME'), $html_template); $html_template = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $html_template); $html_template = str_replace("{product_quantity_lbl}", JText::_('COM_REDSHOP_QUANTITY'), $html_template); $billing = $order_functions->getOrderBillingUserInfo($detail->order_id); $html_template = $carthelper->replaceBillingAddress($html_template, $billing); $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id); $html_template = $carthelper->replaceShippingAddress($html_template, $shipping); $html_template = str_replace("{requisition_number}", $detail->requisition_number, $html_template); $html_template = str_replace("{requisition_number_lbl}", JText::_('COM_REDSHOP_REQUISITION_NUMBER'), $html_template); // start pdf code $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false); $pdfObj->SetTitle("Order StockNote: " . $detail->order_id); $pdfObj->SetAuthor('redSHOP'); $pdfObj->SetCreator('redSHOP'); $pdfObj->SetMargins(15, 15, 15); $font = 'times'; $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id); $pdfObj->setHeaderFont(array($font, '', 10)); //$pdfObj->setFooterFont(array($font, '', 8)); $pdfObj->SetFont($font, "", 10); //$pdfObj->AliasNbPages(); $pdfObj->AddPage(); $pdfObj->WriteHTML($html_template); $pdfObj->Output("StocNoteOrder_" . $detail->order_id . ".pdf", "D"); exit; }
public function newQuotationItem($data) { $quotationHelper = new quotationHelper(); $rsCarthelper = new rsCarthelper(); $producthelper = new producthelper(); $stockroomhelper = new rsstockroomhelper(); $item = $data['quotation_item']; // Get Order Info $quotationdata = $this->getTable('quotation_detail'); $quotationdata->load($this->_id); $user_id = $quotationdata->user_id; // Set Order Item Info $qitemdata = $this->getTable('quotation_item_detail'); for ($i = 0; $i < count($item); $i++) { $product_id = $item[$i]->product_id; $quantity = $item[$i]->quantity; $product_excl_price = $item[$i]->prdexclprice; $product_price = $item[$i]->productprice; $product = $producthelper->getProductById($product_id); $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id); $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity); $product_attribute = $retAttArr[0]; $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id); $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id); $product_accessory = $retAccArr[0]; $wrapper_price = 0; $wrapper_vat = 0; $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data); if (count($wrapper) > 0) { if ($wrapper[0]->wrapper_price > 0) { $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id); } $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat; } $qitemdata =& $this->getTable('quotation_item_detail'); $qitemdata->quotation_item_id = 0; $qitemdata->quotation_id = $this->_id; $qitemdata->product_id = $product_id; $qitemdata->is_giftcard = 0; $qitemdata->product_name = $product->product_name; $qitemdata->actualitem_price = $product_price; $qitemdata->product_price = $product_price; $qitemdata->product_excl_price = $product_excl_price; $qitemdata->product_final_price = $product_price * $quantity; $qitemdata->product_attribute = $product_attribute; $qitemdata->product_accessory = $product_accessory; $qitemdata->product_wrapperid = $item[$i]->wrapper_data; $qitemdata->wrapper_price = $wrapper_price; $qitemdata->product_quantity = $quantity; if (!$qitemdata->store()) { $this->setError($this->_db->getErrorMsg()); return false; } /** my accessory save in table start */ if (count($generateAccessoryCart) > 0) { $attArr = $generateAccessoryCart; for ($a = 0; $a < count($attArr); $a++) { $accessory_vat_price = 0; $accessory_attribute = ""; $accessory_id = $attArr[$a]['accessory_id']; $accessory_name = $attArr[$a]['accessory_name']; $accessory_price = $attArr[$a]['accessory_price']; $accessory_org_price = $accessory_price; if ($accessory_price > 0) { $accessory_vat_price = $producthelper->getProductTax($qitemdata->product_id, $accessory_price, $user_id); } $attchildArr = $attArr[$a]['accessory_childs']; for ($j = 0; $j < count($attchildArr); $j++) { $attribute_id = $attchildArr[$j]['attribute_id']; $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>"; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $accessory_id; $rowattitem->section_name = $attchildArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 1; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attchildArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($qitemdata->product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>"; $subpropArr = $propArr[$k]['property_childs']; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 1; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($qitemdata->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>"; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 1; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } $accdata =& $this->getTable('accessory_detail'); if ($accessory_id > 0) { $accdata->load($accessory_id); } $accProductinfo = $producthelper->getProductById($accdata->child_product_id); $rowaccitem =& $this->getTable('quotation_accessory_item'); $rowaccitem->quotation_item_acc_id = 0; $rowaccitem->quotation_item_id = $qitemdata->quotation_item_id; $rowaccitem->accessory_id = $accessory_id; $rowaccitem->accessory_item_sku = $accProductinfo->product_number; $rowaccitem->accessory_item_name = $accessory_name; $rowaccitem->accessory_price = $accessory_org_price; $rowaccitem->accessory_vat = $accessory_vat_price; $rowaccitem->accessory_quantity = $qitemdata->product_quantity; $rowaccitem->accessory_item_price = $accessory_price; $rowaccitem->accessory_final_price = $accessory_price * $qitemdata->product_quantity; $rowaccitem->accessory_attribute = $accessory_attribute; if ($accessory_id > 0) { if (!$rowaccitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } /** my attribute save in table start */ if (count($generateAttributeCart) > 0) { $attArr = $generateAttributeCart; for ($j = 0; $j < count($attArr); $j++) { $attribute_id = $attArr[$j]['attribute_id']; $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $attribute_id; $rowattitem->section = "attribute"; $rowattitem->parent_section_id = $qitemdata->product_id; $rowattitem->section_name = $attArr[$j]['attribute_name']; $rowattitem->is_accessory_att = 0; if ($attribute_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $propArr = $attArr[$j]['attribute_childs']; for ($k = 0; $k < count($propArr); $k++) { $section_vat = 0; if ($propArr[$k]['property_price'] > 0) { $section_vat = $producthelper->getProducttax($qitemdata->product_id, $propArr[$k]['property_price'], $user_id); } $property_id = $propArr[$k]['property_id']; /** product property STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $qitemdata->product_quantity, "property"); $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $property_id; $rowattitem->section = "property"; $rowattitem->parent_section_id = $attribute_id; $rowattitem->section_name = $propArr[$k]['property_name']; $rowattitem->section_price = $propArr[$k]['property_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $propArr[$k]['property_oprand']; $rowattitem->is_accessory_att = 0; if ($property_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } $subpropArr = $propArr[$k]['property_childs']; for ($l = 0; $l < count($subpropArr); $l++) { $section_vat = 0; if ($subpropArr[$l]['subproperty_price'] > 0) { $section_vat = $producthelper->getProducttax($qitemdata->product_id, $subpropArr[$l]['subproperty_price'], $user_id); } $subproperty_id = $subpropArr[$l]['subproperty_id']; /** product subproperty STOCKROOM update start */ $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $qitemdata->product_quantity, "subproperty"); $rowattitem =& $this->getTable('quotation_attribute_item'); $rowattitem->quotation_att_item_id = 0; $rowattitem->quotation_item_id = $qitemdata->quotation_item_id; $rowattitem->section_id = $subproperty_id; $rowattitem->section = "subproperty"; $rowattitem->parent_section_id = $property_id; $rowattitem->section_name = $subpropArr[$l]['subproperty_name']; $rowattitem->section_price = $subpropArr[$l]['subproperty_price']; $rowattitem->section_vat = $section_vat; $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand']; $rowattitem->is_accessory_att = 0; if ($subproperty_id > 0) { if (!$rowattitem->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } } // Store userfields $userfields = JRequest::getVar('extrafields' . $qitemdata->product_id); $userfields_id = JRequest::getVar('extrafields_id_' . $qitemdata->product_id); for ($ui = 0; $ui < count($userfields); $ui++) { $quotationHelper->insertQuotationUserfield($userfields_id[$ui], $qitemdata->quotation_item_id, 12, $userfields[$ui]); } } // Update Quotation Record $QuotationData = $this->getTable('quotation_detail'); $QuotationData->load($this->_id); $QuotationTotal = 0; $QuotationSubTotal = 0; $QuotationSpDiscount = 0; $QuotationDiscount = 0; $QuotationTotDiscount = 0; $QuotationTax = 0; $quotationItems = $quotationHelper->getQuotationProduct($QuotationData->quotation_id); for ($q = 0; $q < count($quotationItems); $q++) { $QuotationSubTotal += $quotationItems[$q]->product_excl_price * $quotationItems[$q]->product_quantity; $QuotationTax += ($quotationItems[$q]->product_final_price - $quotationItems[$q]->product_excl_price) * $quotationItems[$q]->product_quantity; } // Deduct normal Discount $QuotationDiscount = $QuotationData->quotation_discount; // Special Discount $QuotationSpDiscount = $QuotationData->quotation_special_discount * ($QuotationSubTotal + $QuotationTax) / 100; // Total Discount $QuotationTotDiscount = $QuotationDiscount + $QuotationSpDiscount; // Count final Total $QuotationTotal = $QuotationSubTotal + $QuotationTax - $QuotationTotDiscount; $QuotationData->quotation_tax = $QuotationTax; $QuotationData->quotation_total = $QuotationTotal; $QuotationData->quotation_subtotal = $QuotationSubTotal; $QuotationData->quotation_mdate = time(); if (!$QuotationData->store()) { return false; } else { return true; } // End return true; }