Exemplo n.º 1
1
function listProductUpdateData($products, $setUrl = 0)
{
    $jshopConfig = JSFactory::getConfig();
    $userShop = JSFactory::getUserShop();
    $taxes = JSFactory::getAllTaxes();
    if ($jshopConfig->product_list_show_manufacturer) {
        $manufacturers = JSFactory::getAllManufacturer();
    }
    if ($jshopConfig->product_list_show_vendor) {
        $vendors = JSFactory::getAllVendor();
    }
    if ($jshopConfig->show_delivery_time) {
        $deliverytimes = JSFactory::getAllDeliveryTime();
    }
    $image_path = $jshopConfig->image_product_live_path;
    $noimage = $jshopConfig->noimage;
    JPluginHelper::importPlugin('jshoppingproducts');
    $dispatcher = JDispatcher::getInstance();
    foreach ($products as $key => $value) {
        $dispatcher->trigger('onListProductUpdateDataProduct', array(&$products, &$key, &$value));
        $use_userdiscount = 1;
        if ($jshopConfig->user_discount_not_apply_prod_old_price && $products[$key]->product_old_price > 0) {
            $use_userdiscount = 0;
        }
        $products[$key]->_original_product_price = $products[$key]->product_price;
        $products[$key]->product_price_wp = $products[$key]->product_price;
        $products[$key]->product_price_default = 0;
        if ($jshopConfig->product_list_show_min_price) {
            if ($products[$key]->min_price > 0) {
                $products[$key]->product_price = $products[$key]->min_price;
            }
        }
        $products[$key]->show_price_from = 0;
        if ($jshopConfig->product_list_show_min_price && $value->different_prices) {
            $products[$key]->show_price_from = 1;
        }
        $products[$key]->product_price = getPriceFromCurrency($products[$key]->product_price, $products[$key]->currency_id);
        $products[$key]->product_old_price = getPriceFromCurrency($products[$key]->product_old_price, $products[$key]->currency_id);
        $products[$key]->product_price_wp = getPriceFromCurrency($products[$key]->product_price_wp, $products[$key]->currency_id);
        $products[$key]->product_price = getPriceCalcParamsTax($products[$key]->product_price, $products[$key]->tax_id);
        $products[$key]->product_old_price = getPriceCalcParamsTax($products[$key]->product_old_price, $products[$key]->tax_id);
        $products[$key]->product_price_wp = getPriceCalcParamsTax($products[$key]->product_price_wp, $products[$key]->tax_id);
        if ($userShop->percent_discount && $use_userdiscount) {
            $products[$key]->product_price_default = $products[$key]->_original_product_price;
            $products[$key]->product_price_default = getPriceFromCurrency($products[$key]->product_price_default, $products[$key]->currency_id);
            $products[$key]->product_price_default = getPriceCalcParamsTax($products[$key]->product_price_default, $products[$key]->tax_id);
            $products[$key]->product_price = getPriceDiscount($products[$key]->product_price, $userShop->percent_discount);
            $products[$key]->product_old_price = getPriceDiscount($products[$key]->product_old_price, $userShop->percent_discount);
            $products[$key]->product_price_wp = getPriceDiscount($products[$key]->product_price_wp, $userShop->percent_discount);
        }
        if ($jshopConfig->list_products_calc_basic_price_from_product_price) {
            $products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price_wp);
        } else {
            $products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price);
        }
        if ($value->tax_id) {
            $products[$key]->tax = $taxes[$value->tax_id];
        }
        if ($jshopConfig->product_list_show_manufacturer && $value->product_manufacturer_id && isset($manufacturers[$value->product_manufacturer_id])) {
            $products[$key]->manufacturer = $manufacturers[$value->product_manufacturer_id];
        } else {
            $products[$key]->manufacturer = new stdClass();
            $products[$key]->manufacturer->name = '';
        }
        if ($jshopConfig->admin_show_product_extra_field) {
            $products[$key]->extra_field = getProductExtraFieldForProduct($value);
        } else {
            $products[$key]->extra_field = '';
        }
        if ($jshopConfig->product_list_show_vendor) {
            $vendordata = $vendors[$value->vendor_id];
            $vendordata->products = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendordata->id, 1);
            $products[$key]->vendor = $vendordata;
        } else {
            $products[$key]->vendor = '';
        }
        if ($jshopConfig->hide_delivery_time_out_of_stock && $products[$key]->product_quantity <= 0) {
            $products[$key]->delivery_times_id = 0;
            $value->delivery_times_id = 0;
        }
        if ($jshopConfig->show_delivery_time && $value->delivery_times_id) {
            $products[$key]->delivery_time = $deliverytimes[$value->delivery_times_id];
        } else {
            $products[$key]->delivery_time = '';
        }
        $products[$key]->_display_price = getDisplayPriceForProduct($products[$key]->product_price);
        if (!$products[$key]->_display_price) {
            $products[$key]->product_old_price = 0;
            $products[$key]->product_price_default = 0;
            $products[$key]->basic_price_info['price_show'] = 0;
            $products[$key]->tax = 0;
            $jshopConfig->show_plus_shipping_in_product = 0;
        }
        if ($jshopConfig->product_list_show_qty_stock) {
            $products[$key]->qty_in_stock = getDataProductQtyInStock($products[$key]);
        }
        $image = getPatchProductImage($products[$key]->image, 'thumb');
        $products[$key]->product_name_image = $products[$key]->image;
        $products[$key]->product_thumb_image = $image;
        if (!$image) {
            $image = $noimage;
        }
        $products[$key]->image = $image_path . "/" . $image;
        $products[$key]->template_block_product = "product.php";
        if (!$jshopConfig->admin_show_product_labels) {
            $products[$key]->label_id = null;
        }
        if ($products[$key]->label_id) {
            $image = getNameImageLabel($products[$key]->label_id);
            if ($image) {
                $products[$key]->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
            }
            $products[$key]->_label_name = getNameImageLabel($products[$key]->label_id, 2);
        }
        if ($jshopConfig->display_short_descr_multiline) {
            $products[$key]->short_description = nl2br($products[$key]->short_description);
        }
    }
    if ($setUrl) {
        addLinkToProducts($products, 0, 1);
    }
    $dispatcher->trigger('onListProductUpdateData', array(&$products));
    return $products;
}
Exemplo n.º 2
0
 public function getCheckoutListShippings($adv_user)
 {
     $jshopConfig = JSFactory::getConfig();
     $cart = $this->getCart();
     $shippingmethod = JSFactory::getTable('shippingMethod', 'jshop');
     $shippingmethodprice = JSFactory::getTable('shippingMethodPrice', 'jshop');
     $id_country = $this->getAnyIdCountry($adv_user);
     if (!$id_country) {
         $this->setError(_JSHOP_REGWARN_COUNTRY);
         return false;
     }
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $deliverytimes[0] = '';
     }
     if ($jshopConfig->show_delivery_date) {
         $deliverytimedays = JSFactory::getAllDeliveryTimeDays();
     }
     $sh_pr_method_id = $cart->getShippingPrId();
     $active_shipping = intval($sh_pr_method_id);
     $payment_id = $cart->getPaymentId();
     $shippings = $shippingmethod->getAllShippingMethodsCountry($id_country, $payment_id);
     foreach ($shippings as $key => $value) {
         $shippingmethodprice->load($value->sh_pr_method_id);
         if ($jshopConfig->show_list_price_shipping_weight) {
             $shippings[$key]->shipping_price = $shippingmethodprice->getPricesWeight($value->sh_pr_method_id, $id_country, $cart);
         }
         $prices = $shippingmethodprice->calculateSum($cart);
         $shippings[$key]->calculeprice = $prices['shipping'] + $prices['package'];
         $shippings[$key]->delivery = '';
         $shippings[$key]->delivery_date_f = '';
         if ($jshopConfig->show_delivery_time_checkout) {
             $shippings[$key]->delivery = $deliverytimes[$value->delivery_times_id];
         }
         if ($jshopConfig->show_delivery_date) {
             $day = $deliverytimedays[$value->delivery_times_id];
             if ($day) {
                 $shippings[$key]->delivery_date = getCalculateDeliveryDay($day);
                 $shippings[$key]->delivery_date_f = formatdate($shippings[$key]->delivery_date);
             }
         }
         if ($value->sh_pr_method_id == $active_shipping) {
             $params = $cart->getShippingParams();
         } else {
             $params = array();
         }
         $shippings[$key]->form = $shippingmethod->loadShippingForm($value->shipping_id, $value, $params);
     }
     return $shippings;
 }
Exemplo n.º 3
0
 function getAllItems()
 {
     if (!isset($this->items)) {
         $jshopConfig = JSFactory::getConfig();
         $query = "SELECT OI.* FROM `#__jshopping_order_item` as OI WHERE OI.order_id = '" . $this->_db->escape($this->order_id) . "'";
         $this->_db->setQuery($query);
         $this->items = $this->_db->loadObjectList();
         if ($jshopConfig->display_delivery_time_for_product_in_order_mail) {
             $deliverytimes = JSFactory::getAllDeliveryTime();
             foreach ($this->items as $k => $v) {
                 $this->items[$k]->delivery_time = $deliverytimes[$v->delivery_times_id];
             }
         }
     }
     return $this->items;
 }
Exemplo n.º 4
0
 function order()
 {
     $jshopConfig = JSFactory::getConfig();
     checkUserLogin();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $lang = JSFactory::getLang();
     JPluginHelper::importPlugin('jshoppingorder');
     $dispatcher = JDispatcher::getInstance();
     appendPathWay(_JSHOP_MY_ORDERS, SEFLink('index.php?option=com_jshopping&controller=user&task=orders', 0, 0, $jshopConfig->use_ssl));
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("myorder-detail");
     if ($seodata->title == "") {
         $seodata->title = _JSHOP_MY_ORDERS;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $order_id = JRequest::getInt('order_id');
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     $dispatcher->trigger('onAfterLoadOrder', array(&$order, &$user));
     appendPathWay(_JSHOP_ORDER_NUMBER . ": " . $order->order_number);
     if ($user->id != $order->user_id) {
         JError::raiseError(500, "Error order number. You are not the owner of this order");
     }
     $order->items = $order->getAllItems();
     $order->weight = $order->getWeightItems();
     $order->status_name = $order->getStatus();
     $order->history = $order->getHistory();
     if ($jshopConfig->client_allow_cancel_order && $order->order_status != $jshopConfig->payment_status_for_cancel_client && !in_array($order->order_status, $jshopConfig->payment_status_disable_cancel_client)) {
         $allow_cancel = 1;
     } else {
         $allow_cancel = 0;
     }
     $order->birthday = getDisplayDate($order->birthday, $jshopConfig->field_birthday_format);
     $order->d_birthday = getDisplayDate($order->d_birthday, $jshopConfig->field_birthday_format);
     $shipping_method = JTable::getInstance('shippingMethod', 'jshop');
     $shipping_method->load($order->shipping_method_id);
     $name = $lang->get("name");
     $description = $lang->get("description");
     $order->shipping_info = $shipping_method->{$name};
     $pm_method = JTable::getInstance('paymentMethod', 'jshop');
     $pm_method->load($order->payment_method_id);
     $order->payment_name = $pm_method->{$name};
     if ($pm_method->show_descr_in_email) {
         $order->payment_description = $pm_method->{$description};
     } else {
         $order->payment_description = "";
     }
     $country = JTable::getInstance('country', 'jshop');
     $country->load($order->country);
     $field_country_name = $lang->get("name");
     $order->country = $country->{$field_country_name};
     $d_country = JTable::getInstance('country', 'jshop');
     $d_country->load($order->d_country);
     $field_country_name = $lang->get("name");
     $order->d_country = $d_country->{$field_country_name};
     $jshopConfig->user_field_client_type[0] = "";
     $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
     $order->delivery_time_name = '';
     $order->delivery_date_f = '';
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $order->delivery_time_name = $deliverytimes[$order->delivery_times_id];
         if ($order->delivery_time_name == "") {
             $order->delivery_time_name = $order->delivery_time;
         }
     }
     if ($jshopConfig->show_delivery_date && !datenull($order->delivery_date)) {
         $order->delivery_date_f = formatdate($order->delivery_date);
     }
     $order->order_tax_list = $order->getTaxExt();
     $show_percent_tax = 0;
     if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
         $show_percent_tax = 1;
     }
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     $hide_subtotal = 0;
     if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
         $hide_subtotal = 1;
     }
     $text_total = _JSHOP_ENDTOTAL;
     if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
         $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields["address"];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     if ($jshopConfig->order_display_new_digital_products) {
         $product = JTable::getInstance('product', 'jshop');
         foreach ($order->items as $k => $v) {
             $product->product_id = $v->product_id;
             $product->setAttributeActive(unserialize($v->attributes));
             $files = $product->getSaleFiles();
             $order->items[$k]->files = serialize($files);
         }
     }
     $dispatcher->trigger('onBeforeDisplayOrder', array(&$order));
     $view_name = "order";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("order");
     $view->assign('order', $order);
     $view->assign('config', $jshopConfig);
     $view->assign('text_total', $text_total);
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('image_path', $jshopConfig->live_path . "images");
     $view->assign('config_fields', $config_fields);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('allow_cancel', $allow_cancel);
     $dispatcher->trigger('onBeforeDisplayOrderView', array(&$view));
     $view->display();
 }
Exemplo n.º 5
0
 function _showSmallCart($step = 0)
 {
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     $cart = JModelLegacy::getInstance('cart', 'jshop');
     $cart->load();
     $cart->addLinkToProducts(0);
     $cart->setDisplayFreeAttributes();
     if ($step == 5) {
         $cart->setDisplayItem(1, 1);
     } elseif ($step == 4 && !$jshopConfig->step_4_3) {
         $cart->setDisplayItem(0, 1);
     } elseif ($step == 3 && $jshopConfig->step_4_3) {
         $cart->setDisplayItem(1, 0);
     } else {
         $cart->setDisplayItem(0, 0);
     }
     $cart->updateDiscountData();
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplaySmallCart', array(&$cart));
     $view_name = "cart";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("checkout");
     $view->assign('step', $step);
     $view->assign('config', $jshopConfig);
     $view->assign('products', $cart->products);
     $view->assign('summ', $cart->getPriceProducts());
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('no_image', $jshopConfig->noimage);
     $view->assign('discount', $cart->getDiscountShow());
     $view->assign('free_discount', $cart->getFreeDiscount());
     $deliverytimes = JSFactory::getAllDeliveryTime();
     $view->assign('deliverytimes', $deliverytimes);
     $lang = JSFactory::getLang();
     $name = $lang->get("name");
     $payment_method_id = $cart->getPaymentId();
     if ($payment_method_id) {
         $pm_method = JTable::getInstance('paymentMethod', 'jshop');
         $pm_method->load($payment_method_id);
         $payment_name = $pm_method->{$name};
     } else {
         $payment_name = '';
     }
     $view->assign('payment_name', $payment_name);
     if ($step == 5) {
         if (!$jshopConfig->without_shipping) {
             $view->assign('summ_delivery', $cart->getShippingPrice());
             if ($cart->getPackagePrice() > 0 || $jshopConfig->display_null_package_price) {
                 $view->assign('summ_package', $cart->getPackagePrice());
             }
             $view->assign('summ_payment', $cart->getPaymentPrice());
             $fullsumm = $cart->getSum(1, 1, 1);
             $tax_list = $cart->getTaxExt(1, 1, 1);
         } else {
             $view->assign('summ_payment', $cart->getPaymentPrice());
             $fullsumm = $cart->getSum(0, 1, 1);
             $tax_list = $cart->getTaxExt(0, 1, 1);
         }
     } elseif ($step == 4 && !$jshopConfig->step_4_3) {
         $view->assign('summ_payment', $cart->getPaymentPrice());
         $fullsumm = $cart->getSum(0, 1, 1);
         $tax_list = $cart->getTaxExt(0, 1, 1);
     } elseif ($step == 3 && $jshopConfig->step_4_3) {
         $view->assign('summ_delivery', $cart->getShippingPrice());
         if ($cart->getPackagePrice() > 0 || $jshopConfig->display_null_package_price) {
             $view->assign('summ_package', $cart->getPackagePrice());
         }
         $fullsumm = $cart->getSum(1, 1, 0);
         $tax_list = $cart->getTaxExt(1, 1, 0);
     } else {
         $fullsumm = $cart->getSum(0, 1, 0);
         $tax_list = $cart->getTaxExt(0, 1, 0);
     }
     $show_percent_tax = 0;
     if (count($tax_list) > 1 || $jshopConfig->show_tax_in_product) {
         $show_percent_tax = 1;
     }
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     $hide_subtotal = 0;
     if ($step == 5) {
         if (($jshopConfig->hide_tax || count($tax_list) == 0) && !$cart->rabatt_summ && $jshopConfig->without_shipping && $cart->getPaymentPrice() == 0) {
             $hide_subtotal = 1;
         }
     } elseif ($step == 4 && !$jshopConfig->step_4_3) {
         if (($jshopConfig->hide_tax || count($tax_list) == 0) && !$cart->rabatt_summ && $cart->getPaymentPrice() == 0) {
             $hide_subtotal = 1;
         }
     } elseif ($step == 3 && $jshopConfig->step_4_3) {
         if (($jshopConfig->hide_tax || count($tax_list) == 0) && !$cart->rabatt_summ && $jshopConfig->without_shipping) {
             $hide_subtotal = 1;
         }
     } else {
         if (($jshopConfig->hide_tax || count($tax_list) == 0) && !$cart->rabatt_summ) {
             $hide_subtotal = 1;
         }
     }
     $text_total = _JSHOP_PRICE_TOTAL;
     if ($step == 5) {
         $text_total = _JSHOP_ENDTOTAL;
         if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($tax_list) > 0) {
             $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
         }
     }
     $view->assign('tax_list', $tax_list);
     $view->assign('fullsumm', $fullsumm);
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('text_total', $text_total);
     $view->assign('weight', $cart->getWeightProducts());
     $dispatcher->trigger('onBeforeDisplayCheckoutCartView', array(&$view));
     return $view->loadTemplate();
 }
Exemplo n.º 6
0
 function edit()
 {
     $mainframe = JFactory::getApplication();
     $order_id = JRequest::getVar("order_id");
     $client_id = JRequest::getInt('client_id', 0);
     $lang = JSFactory::getLang();
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     $orders = $this->getModel("orders");
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     $name = $lang->get("name");
     $id_vendor_cuser = getIdVendorForCUser();
     if ($jshopConfig->admin_show_vendors && $id_vendor_cuser) {
         if ($order->vendor_id != $id_vendor_cuser) {
             $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
             return 0;
         }
     }
     $order_items = $order->getAllItems();
     $_languages = $this->getModel("languages");
     $languages = $_languages->getAllLanguages(1);
     $select_language = JHTML::_('select.genericlist', $languages, 'lang', 'class = "inputbox" style="float:none"', 'language', 'name', $order->lang);
     $country = JTable::getInstance('country', 'jshop');
     $countries = $country->getAllCountries();
     $select_countries = JHTML::_('select.genericlist', $countries, 'country', 'class = "inputbox"', 'country_id', 'name', $order->country);
     $select_d_countries = JHTML::_('select.genericlist', $countries, 'd_country', 'class = "inputbox"', 'country_id', 'name', $order->d_country);
     $option_title = array();
     foreach ($jshopConfig->user_field_title as $key => $value) {
         if ($key > 0) {
             $option_title[] = JHTML::_('select.option', $key, $value, 'title_id', 'title_name');
         }
     }
     $select_titles = JHTML::_('select.genericlist', $option_title, 'title', 'class = "inputbox"', 'title_id', 'title_name', $order->title);
     $select_d_titles = JHTML::_('select.genericlist', $option_title, 'd_title', 'class = "inputbox endes"', 'title_id', 'title_name', $order->d_title);
     $order->birthday = getDisplayDate($order->birthday, $jshopConfig->field_birthday_format);
     $order->d_birthday = getDisplayDate($order->d_birthday, $jshopConfig->field_birthday_format);
     $client_types = array();
     foreach ($jshopConfig->user_field_client_type as $key => $value) {
         $client_types[] = JHTML::_('select.option', $key, $value, 'id', 'name');
     }
     $select_client_types = JHTML::_('select.genericlist', $client_types, 'client_type', 'class = "inputbox" onchange="showHideFieldFirm(this.value)"', 'id', 'name', $order->client_type);
     $jshopConfig->user_field_client_type[0] = "";
     if (isset($jshopConfig->user_field_client_type[$order->client_type])) {
         $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
     } else {
         $order->client_type_name = '';
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields["address"];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $pm_method = JTable::getInstance('paymentMethod', 'jshop');
     $pm_method->load($order->payment_method_id);
     $order->payment_name = $pm_method->{$name};
     $order->order_tax_list = $order->getTaxExt();
     $_currency = $this->getModel("currencies");
     $currency_list = $_currency->getAllCurrencies();
     $order_currency = 0;
     foreach ($currency_list as $k => $v) {
         if ($v->currency_code_iso == $order->currency_code_iso) {
             $order_currency = $v->currency_id;
         }
     }
     $select_currency = JHTML::_('select.genericlist', $currency_list, 'currency_id', 'class = "inputbox"', 'currency_id', 'currency_code', $order_currency);
     $display_price_list = array();
     $display_price_list[] = JHTML::_('select.option', 0, _JSHOP_PRODUCT_BRUTTO_PRICE, 'id', 'name');
     $display_price_list[] = JHTML::_('select.option', 1, _JSHOP_PRODUCT_NETTO_PRICE, 'id', 'name');
     $display_price_select = JHTML::_('select.genericlist', $display_price_list, 'display_price', 'onchange="updateOrderTotalValue();"', 'id', 'name', $order->display_price);
     $shippings = $this->getModel("shippings");
     $shippings_list = $shippings->getAllShippings(0);
     $shippings_select = JHTML::_('select.genericlist', $shippings_list, 'shipping_method_id', '', 'shipping_id', 'name', $order->shipping_method_id);
     $payments = $this->getModel("payments");
     $payments_list = $payments->getAllPaymentMethods(0);
     $payments_select = JHTML::_('select.genericlist', $payments_list, 'payment_method_id', '', 'payment_id', 'name', $order->payment_method_id);
     $deliverytimes = JSFactory::getAllDeliveryTime();
     $first = array(0 => "- - -");
     $delivery_time_select = JHTML::_('select.genericlist', array_merge($first, $deliverytimes), 'delivery_times_id', '', 'id', 'name', $order->delivery_times_id);
     $users = $this->getModel('users');
     $users_list = $users->getUsers();
     $first = array(0 => '- - -');
     $users_list_select = JHTML::_('select.genericlist', array_merge($first, $users_list), 'user_id', 'onchange="updateBillingShippingForUser(this.value);"', 'user_id', 'name', $order->user_id);
     filterHTMLSafe($order);
     foreach ($order_items as $k => $v) {
         JFilterOutput::objectHTMLSafe($order_items[$k]);
     }
     JHTML::_('behavior.calendar');
     $view = $this->getView("orders", 'html');
     $view->setLayout("edit");
     $view->assign('config', $jshopConfig);
     $view->assign('order', $order);
     $view->assign('order_items', $order_items);
     $view->assign('config_fields', $config_fields);
     $view->assign('etemplatevar', '');
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('order_id', $order_id);
     $view->assign('select_countries', $select_countries);
     $view->assign('select_d_countries', $select_d_countries);
     $view->assign('select_titles', $select_titles);
     $view->assign('select_d_titles', $select_d_titles);
     $view->assign('select_client_types', $select_client_types);
     $view->assign('select_currency', $select_currency);
     $view->assign('display_price_select', $display_price_select);
     $view->assign('shippings_select', $shippings_select);
     $view->assign('payments_select', $payments_select);
     $view->assign('select_language', $select_language);
     $view->assign('delivery_time_select', $delivery_time_select);
     $view->assign('users_list_select', $users_list_select);
     $view->assign('client_id', $client_id);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditOrders', array(&$view));
     $view->displayEdit();
 }
Exemplo n.º 7
0
 public function onBeforeDisplayCheckoutFinish(&$text, &$order_id)
 {
     $user = JFactory::getUser();
     if ($user->id > 0) {
         return true;
     }
     // Скрытие текста
     $text = '&nbsp;';
     // Показ гостю копии страницы из личного кабинета
     // $dispatcher = JDispatcher::getInstance();
     $jshopConfig = JSFactory::getConfig();
     $lang = JSFactory::getLang();
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     $order->items = $order->getAllItems();
     $order->weight = $order->getWeightItems();
     $order->status_name = $order->getStatus();
     $order->history = $order->getHistory();
     $order->order_tax_list = $order->getTaxExt();
     $order->birthday = getDisplayDate($order->birthday, $jshopConfig->field_birthday_format);
     $order->d_birthday = getDisplayDate($order->d_birthday, $jshopConfig->field_birthday_format);
     $name = $lang->get("name");
     $description = $lang->get("description");
     $pm_method = JTable::getInstance('paymentMethod', 'jshop');
     $pm_method->load($order->payment_method_id);
     $order->payment_name = $pm_method->{$name};
     if ($pm_method->show_descr_in_email) {
         $order->payment_description = $pm_method->{$description};
     } else {
         $order->payment_description = "";
     }
     $country = JTable::getInstance('country', 'jshop');
     $country->load($order->country);
     $field_country_name = $lang->get("name");
     $order->country = $country->{$field_country_name};
     $d_country = JTable::getInstance('country', 'jshop');
     $d_country->load($order->d_country);
     $field_country_name = $lang->get("name");
     $order->d_country = $d_country->{$field_country_name};
     $jshopConfig->user_field_client_type[0] = "";
     $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
     $order->delivery_time_name = '';
     $order->delivery_date_f = '';
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $order->delivery_time_name = $deliverytimes[$order->delivery_times_id];
         if ($order->delivery_time_name == "") {
             $order->delivery_time_name = $order->delivery_time;
         }
     }
     if ($jshopConfig->show_delivery_date && !datenull($order->delivery_date)) {
         $order->delivery_date_f = formatdate($order->delivery_date);
     }
     if ($order->weight == 0 && $jshopConfig->hide_weight_in_cart_weight0) {
         $jshopConfig->show_weight_order = 0;
     }
     $jshopConfig->order_send_pdf_client = 0;
     $show_percent_tax = 0;
     if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
         $show_percent_tax = 1;
     }
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     $hide_subtotal = 0;
     if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
         $hide_subtotal = 1;
     }
     $text_total = _JSHOP_ENDTOTAL;
     if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
         $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields["address"];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $className = 'JshoppingViewOrder';
     $view_name = "order";
     if (!class_exists($className)) {
         require_once JPATH_COMPONENT . '/views/' . $view_name . '/view.html.php';
     }
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = new $className($view_config);
     $view->setLayout("order");
     $view->assign('order', $order);
     $view->assign('config', $jshopConfig);
     $view->assign('text_total', $text_total);
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('image_path', $jshopConfig->live_path . "images");
     $view->assign('config_fields', $config_fields);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('allow_cancel', false);
     $view->display();
     return true;
 }
function generatePDF($order)
{
    $jshopConfig = JSFactory::getConfig();
    $vendorinfo = $order->getVendorInfo();
    $pdf = new JorderPDF();
    JPluginHelper::importPlugin('jshoppingorder');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onBeforeCreatePdfOrder', array(&$order, &$vendorinfo, &$pdf));
    $pdf->_vendorinfo = $vendorinfo;
    $pdf->SetFont('freesans', '', 8);
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetMargins(0, 0, 0);
    $pdf->addNewPage();
    $pdf->SetXY(20, 55);
    $pdf->setfontsize(6);
    $pdf->SetTextColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->MultiCell(80, 3, $vendorinfo->company_name . ", " . $vendorinfo->adress . ", " . $vendorinfo->zip . " " . $vendorinfo->city, 0, 'L');
    $pdf->SetXY(110, 55);
    $pdf->SetFont('freesansb', '', 11);
    $pdf->SetTextColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->MultiCell(80, 3, _JSHOP_EMAIL_BILL, 0, 'R');
    $pdf->SetFont('freesans', '', 11);
    $pdf->SetXY(20, 60);
    $pdf->MultiCell(80, 4.5, $order->firma_name . "\n" . $order->f_name . " " . $order->l_name . " " . $order->m_name . "\n" . $order->street . " " . $order->home . " " . $order->apartment . "\n" . $order->zip . " " . $order->city . "\n" . $order->country, 0, 'L');
    $pdf->SetFont('freesansi', '', 11);
    $pdf->SetXY(110, 65);
    $pdf->MultiCell(80, 4.5, _JSHOP_ORDER_SHORT_NR . " " . $order->order_number . "\n" . _JSHOP_ORDER_FROM . " " . $order->order_date, 0, 'R');
    if ($jshopConfig->date_invoice_in_invoice) {
        $pdf->SetXY(110, 77);
        $pdf->MultiCell(80, 4.5, _JSHOP_INVOICE_DATE . " " . strftime($jshopConfig->store_date_format, strtotime($order->invoice_date)), 0, 'R');
    }
    $pdf->SetDrawColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->SetFont('freesans', '', 7);
    if ($vendorinfo->identification_number) {
        $pdf->SetXY(115, 102);
        $pdf->MultiCell(35, 4, _JSHOP_IDENTIFICATION_NUMBER, 1, 'L');
        $pdf->SetXY(150, 102);
        $pdf->MultiCell(40, 4, $vendorinfo->identification_number, 1, 'R');
    }
    if ($vendorinfo->tax_number) {
        $pdf->SetXY(115, 106);
        $pdf->MultiCell(35, 4, _JSHOP_TAX_NUMBER, 1, 'L');
        $pdf->SetXY(150, 106);
        $pdf->MultiCell(40, 4, $vendorinfo->tax_number, 1, 'R');
    }
    $width_filename = 65;
    if (!$jshopConfig->show_product_code_in_order) {
        $width_filename = 87;
    }
    $pdf->setfillcolor($pdf->pdfcolors[1][0], $pdf->pdfcolors[1][1], $pdf->pdfcolors[1][2]);
    $pdf->Rect(20, 116, 170, 4, 'F');
    $pdf->SetFont('freesansb', '', 7.5);
    $pdf->SetXY(20, 116);
    $pdf->MultiCell($width_filename, 4, _JSHOP_NAME_PRODUCT, 1, 'L');
    if ($jshopConfig->show_product_code_in_order) {
        $pdf->SetXY(85, 116);
        $pdf->MultiCell(22, 4, _JSHOP_EAN_PRODUCT, 1, 'L');
    }
    $pdf->SetXY(107, 116);
    $pdf->MultiCell(18, 4, _JSHOP_QUANTITY, 1, 'L');
    $pdf->SetXY(125, 116);
    $pdf->MultiCell(25, 4, _JSHOP_SINGLEPRICE, 1, 'L');
    $pdf->SetXY(150, 116);
    $pdf->MultiCell(40, 4, _JSHOP_TOTAL, 1, 'R');
    $y = 120;
    foreach ($order->products as $prod) {
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 2);
        $pdf->MultiCell($width_filename, 4, $prod->product_name, 0, 'L');
        if ($prod->manufacturer != '') {
            $pdf->SetXY(20, $pdf->getY());
            $pdf->MultiCell($width_filename, 4, _JSHOP_MANUFACTURER . ": " . $prod->manufacturer, 0, 'L');
        }
        if ($prod->product_attributes != "" || $prod->product_freeattributes != "" || $prod->delivery_time || $prod->extra_fields != '') {
            if ($prod->delivery_time) {
                $pdt = _JSHOP_DELIVERY_TIME . ": " . $prod->delivery_time;
            } else {
                $pdt = "";
            }
            $pdf->SetXY(23, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $attribute = sprintAtributeInOrder($prod->product_attributes, "pdf");
            $attribute .= sprintFreeAtributeInOrder($prod->product_freeattributes, "pdf");
            $attribute .= sprintExtraFiledsInOrder($prod->extra_fields, "pdf");
            $attribute .= $prod->_ext_attribute;
            $attribute .= $pdt;
            $pdf->MultiCell(62, 4, $attribute, 0, 'L');
            $pdf->SetFont('freesans', '', 7);
        }
        $y2 = $pdf->getY() + 2;
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->SetXY(85, $y + 2);
            $pdf->MultiCell(22, 4, $prod->product_ean, 0, 'L');
            $y3 = $pdf->getY() + 2;
        } else {
            $y3 = $pdf->getY();
        }
        $pdf->SetXY(107, $y + 2);
        $pdf->MultiCell(18, 4, formatqty($prod->product_quantity) . $prod->_qty_unit, 0, 'L');
        $y4 = $pdf->getY() + 2;
        $pdf->SetXY(125, $y + 2);
        $pdf->MultiCell(25, 4, formatprice($prod->product_item_price, $order->currency_code), 0, 'L');
        if ($prod->_ext_price) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->MultiCell(25, 4, $prod->_ext_price, 0, 'R');
        }
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(25, 4, $text, 0, 'L');
        }
        if ($jshopConfig->cart_basic_price_show && $prod->basicprice > 0) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = _JSHOP_BASIC_PRICE . ": " . sprintBasicPrice($prod);
            $pdf->MultiCell(25, 4, $text, 0, 'L');
        }
        $y5 = $pdf->getY() + 2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(150, $y + 2);
        $pdf->MultiCell(40, 4, formatprice($prod->product_quantity * $prod->product_item_price, $order->currency_code), 0, 'R');
        if ($prod->_ext_price_total) {
            $pdf->SetXY(150, $pdf->getY());
            $pdf->MultiCell(40, 4, $prod->_ext_price_total, 0, 'R');
        }
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(150, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(40, 4, $text, 0, 'R');
        }
        $y6 = $pdf->getY() + 2;
        $yn = max($y2, $y3, $y4, $y5, $y6);
        $pdf->Rect(20, $y, 170, $yn - $y);
        $pdf->Rect(20, $y, 130, $yn - $y);
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->line(85, $y, 85, $yn);
        }
        $pdf->line(107, $y, 107, $yn);
        $pdf->line(125, $y, 125, $yn);
        $y = $yn;
        if ($y > 260) {
            $pdf->addNewPage();
            $y = 60;
        }
    }
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    $pdf->SetFont('freesans', '', 10);
    if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
        $hide_subtotal = 1;
    } else {
        $hide_subtotal = 0;
    }
    if (!$hide_subtotal) {
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SUBTOTAL, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, formatprice($order->order_subtotal, $order->currency_code) . $order->_pdf_ext_subtotal, '1', 'R');
    } else {
        $y = $y - 5;
    }
    if ($order->order_discount > 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_RABATT_VALUE, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, "-" . formatprice($order->order_discount, $order->currency_code) . $order->_pdf_ext_discount, '1', 'R');
    }
    if (!$jshopConfig->without_shipping) {
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SHIPPING_PRICE, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_shipping, $order->currency_code) . $order->_pdf_ext_shipping, '1', 'R');
        if ($order->order_package > 0 || $jshopConfig->display_null_package_price) {
            $y = $y + 5;
            $pdf->SetXY(20, $y + 5);
            $pdf->Rect(20, $y + 5, 170, 5, 'F');
            $pdf->MultiCell(130, 5, _JSHOP_PACKAGE_PRICE, '1', 'R');
            $pdf->SetXY(150, $y + 5);
            $pdf->MultiCell(40, 5, formatprice($order->order_package, $order->currency_code) . $order->_pdf_ext_shipping_package, '1', 'R');
        }
    } else {
        $y = $y - 5;
    }
    if ($order->order_payment != 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, $order->payment_name, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_payment, $order->currency_code) . $order->_pdf_ext_payment, '1', 'R');
    }
    $show_percent_tax = 0;
    if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
        $show_percent_tax = 1;
    }
    if ($jshopConfig->hide_tax) {
        $show_percent_tax = 0;
    }
    $dispatcher->trigger('onBeforeCreatePdfOrderBeforeEndTotal', array(&$order, &$pdf, &$y));
    if (!$jshopConfig->hide_tax) {
        foreach ($order->order_tax_list as $percent => $value) {
            $pdf->SetXY(20, $y + 10);
            $pdf->Rect(20, $y + 10, 170, 5, 'F');
            $text = displayTotalCartTaxName($order->display_price);
            if ($show_percent_tax) {
                $text = $text . " " . formattax($percent) . "%";
            }
            $pdf->MultiCell(130, 5, $text, '1', 'R');
            $pdf->SetXY(150, $y + 10);
            $pdf->MultiCell(40, 5, formatprice($value, $order->currency_code) . $order->_pdf_ext_tax[$percent], '1', 'R');
            $y = $y + 5;
        }
    }
    $text_total = _JSHOP_ENDTOTAL;
    if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
        $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
    }
    $pdf->SetFont('freesansb', '', 10);
    $pdf->SetXY(20, $y + 10);
    $pdf->Rect(20, $y + 10, 170, 5.1, 'F');
    $pdf->MultiCell(130, 5, $text_total, '1', 'R');
    $pdf->SetXY(150, $y + 10);
    $pdf->MultiCell(40, 5, formatprice($order->order_total, $order->currency_code) . $order->_pdf_ext_total, '1', 'R');
    if ($jshopConfig->display_tax_id_in_pdf && $order->tax_number) {
        $y = $y + 5.2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 10);
        $pdf->MultiCell(170, 4, _JSHOP_TAX_NUMBER . ": " . $order->tax_number, '1', 'L');
    }
    $dispatcher->trigger('onBeforeCreatePdfOrderAfterEndTotal', array(&$order, &$pdf, &$y));
    $y = $y + 10;
    if ($jshopConfig->show_delivery_time_checkout && ($order->delivery_times_id || $order->delivery_time)) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $deliverytimes = JSFactory::getAllDeliveryTime();
        $delivery = $deliverytimes[$order->delivery_times_id];
        if ($delivery == "") {
            $delivery = $order->delivery_time;
        }
        $y = $y + 8;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_ORDER_DELIVERY_TIME . ": " . $delivery, '0', 'L');
    }
    if ($jshopConfig->show_delivery_date && !datenull($order->delivery_date)) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $delivery_date_f = formatdate($order->delivery_date);
        $y = $y + 6;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_DELIVERY_DATE . ": " . $delivery_date_f, '0', 'L');
    }
    if ($jshopConfig->weight_in_invoice) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_WEIGHT_PRODUCTS . ": " . formatweight($order->weight), '0', 'L');
    }
    if (!$jshopConfig->without_payment && $jshopConfig->payment_in_invoice) {
        if ($y > 240) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesansb', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_PAYMENT_INFORMATION, '0', 'L');
        $y = $y + 4;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, $order->payment_name, '0', 'L');
        $payment_descr = trim(trim($order->payment_information) . "\n" . $order->payment_description);
        if ($payment_descr != '') {
            $y = $y + 4;
            $pdf->SetXY(20, $y);
            $pdf->MultiCell(170, 4, strip_tags($payment_descr), '0', 'L');
            $y = $pdf->getY() - 4;
        }
    }
    if (!$jshopConfig->without_shipping && $jshopConfig->shipping_in_invoice) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesansb', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_SHIPPING_INFORMATION, '0', 'L');
        $y = $y + 4;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, $order->shipping_information, '0', 'L');
    }
    $y = $y + 20;
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    $pdf->SetFont('freesans', '', 7);
    $y2 = 0;
    if ($vendorinfo->benef_bank_info || $vendorinfo->benef_bic || $vendorinfo->benef_conto || $vendorinfo->benef_payee || $vendorinfo->benef_iban || $vendorinfo->benef_swift) {
        $pdf->SetXY(115, $y);
        $pdf->Rect(115, $y, 75, 4, 'F');
        $pdf->MultiCell(75, 4, _JSHOP_BANK, '1', 'L');
    }
    if ($vendorinfo->benef_bank_info) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_BANK_NAME, '1', 'L');
    }
    if ($vendorinfo->benef_bic) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_BIC, '1', 'L');
    }
    if ($vendorinfo->benef_conto) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_CONTO, '1', 'L');
    }
    if ($vendorinfo->benef_payee) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_PAYEE, '1', 'L');
    }
    if ($vendorinfo->benef_iban) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_IBAN, '1', 'L');
    }
    if ($vendorinfo->benef_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_SWIFT, '1', 'L');
    }
    if ($vendorinfo->interm_name || $vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->Rect(115, $y2 + $y, 75, 4, 'F');
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_BANK, '1', 'L');
    }
    if ($vendorinfo->interm_name) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_NAME, '1', 'L');
    }
    if ($vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_SWIFT, '1', 'L');
    }
    $y2 = 0;
    if ($vendorinfo->benef_bank_info) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_bank_info, '0', 'R');
    }
    if ($vendorinfo->benef_bic) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_bic, '0', 'R');
    }
    if ($vendorinfo->benef_conto) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_conto, '0', 'R');
    }
    if ($vendorinfo->benef_payee) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_payee, '0', 'R');
    }
    if ($vendorinfo->benef_iban) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_iban, '0', 'R');
    }
    if ($vendorinfo->benef_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_swift, '0', 'R');
    }
    $y2 += 4;
    if ($vendorinfo->interm_name) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->interm_name, '0', 'R');
    }
    if ($vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->interm_swift, '0', 'R');
    }
    if ($vendorinfo->additional_information) {
        if ($y2 + $y > 240) {
            $pdf->addNewPage();
            $y = 50;
            $y2 = 0;
        }
        $y2 += 6;
        $pdf->SetXY(20, $y2 + $y);
        $pdf->MultiCell(170, 4, $vendorinfo->additional_information, '0', 'L');
    }
    $name_pdf = $order->order_id . "_" . md5(uniqid(rand(0, 100))) . ".pdf";
    $dispatcher->trigger('onBeforeCreatePdfOrderEnd', array(&$order, &$pdf, &$name_pdf));
    $pdf->Output($jshopConfig->pdf_orders_path . "/" . $name_pdf, 'F');
    return $name_pdf;
}
Exemplo n.º 9
0
 function sendOrderEmail($order_id, $manuallysend = 0)
 {
     $mainframe = JFactory::getApplication();
     $lang = JSFactory::getLang();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $order = JSFactory::getTable('order', 'jshop');
     $jshopConfig->user_field_title[0] = '';
     $jshopConfig->user_field_client_type[0] = '';
     $file_generete_pdf_order = $jshopConfig->file_generete_pdf_order;
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields["address"];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $order->load($order_id);
     $status = JSFactory::getTable('orderStatus', 'jshop');
     $status->load($order->order_status);
     $name = $lang->get("name");
     $order->status = $status->{$name};
     $order->order_date = strftime($jshopConfig->store_date_format, strtotime($order->order_date));
     $order->products = $order->getAllItems();
     $order->weight = $order->getWeightItems();
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $order->order_delivery_time = $deliverytimes[$order->delivery_times_id];
         if ($order->order_delivery_time == "") {
             $order->order_delivery_time = $order->delivery_time;
         }
     }
     $order->order_tax_list = $order->getTaxExt();
     $show_percent_tax = 0;
     if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
         $show_percent_tax = 1;
     }
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     $hide_subtotal = 0;
     if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $jshopConfig->without_shipping && $order->order_payment == 0) {
         $hide_subtotal = 1;
     }
     if ($order->weight == 0 && $jshopConfig->hide_weight_in_cart_weight0) {
         $jshopConfig->show_weight_order = 0;
     }
     $country = JSFactory::getTable('country', 'jshop');
     $country->load($order->country);
     $field_country_name = $lang->get("name");
     $order->country = $country->{$field_country_name};
     $d_country = JSFactory::getTable('country', 'jshop');
     $d_country->load($order->d_country);
     $field_country_name = $lang->get("name");
     $order->d_country = $d_country->{$field_country_name};
     if ($jshopConfig->show_delivery_date && !datenull($order->delivery_date)) {
         $order->delivery_date_f = formatdate($order->delivery_date);
     } else {
         $order->delivery_date_f = '';
     }
     $order->title = $jshopConfig->user_field_title[$order->title];
     $order->d_title = $jshopConfig->user_field_title[$order->d_title];
     $order->birthday = getDisplayDate($order->birthday, $jshopConfig->field_birthday_format);
     $order->d_birthday = getDisplayDate($order->d_birthday, $jshopConfig->field_birthday_format);
     $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
     $shippingMethod = JSFactory::getTable('shippingMethod', 'jshop');
     $shippingMethod->load($order->shipping_method_id);
     $pm_method = JSFactory::getTable('paymentMethod', 'jshop');
     $pm_method->load($order->payment_method_id);
     $paymentsysdata = $pm_method->getPaymentSystemData();
     $payment_system = $paymentsysdata->paymentSystem;
     $name = $lang->get("name");
     $description = $lang->get("description");
     $order->shipping_information = $shippingMethod->{$name};
     $shippingForm = $shippingMethod->getShippingForm();
     if ($shippingForm) {
         $shippingForm->prepareParamsDispayMail($order, $shippingMethod);
     }
     $order->payment_name = $pm_method->{$name};
     $order->payment_information = $order->payment_params;
     if ($payment_system) {
         $payment_system->prepareParamsDispayMail($order, $pm_method);
     }
     if ($pm_method->show_descr_in_email) {
         $order->payment_description = $pm_method->{$description};
     } else {
         $order->payment_description = "";
     }
     $statictext = JSFactory::getTable("statictext", "jshop");
     $rowstatictext = $statictext->loadData("order_email_descr");
     $order_email_descr = $rowstatictext->text;
     $order_email_descr = str_replace("{name}", $order->f_name, $order_email_descr);
     $order_email_descr = str_replace("{family}", $order->l_name, $order_email_descr);
     $order_email_descr = str_replace("{email}", $order->email, $order_email_descr);
     $order_email_descr = str_replace("{title}", $order->title, $order_email_descr);
     $rowstatictext = $statictext->loadData("order_email_descr_end");
     $order_email_descr_end = $rowstatictext->text;
     $order_email_descr_end = str_replace("{name}", $order->f_name, $order_email_descr_end);
     $order_email_descr_end = str_replace("{family}", $order->l_name, $order_email_descr_end);
     $order_email_descr_end = str_replace("{email}", $order->email, $order_email_descr_end);
     $order_email_descr_end = str_replace("{title}", $order->title, $order_email_descr_end);
     if ($jshopConfig->show_return_policy_text_in_email_order) {
         $list = $order->getReturnPolicy();
         $listtext = array();
         foreach ($list as $v) {
             $listtext[] = $v->text;
         }
         $rptext = implode('<div class="return_policy_space"></div>', $listtext);
         $order_email_descr_end = $rptext . $order_email_descr_end;
     }
     $text_total = _JSHOP_ENDTOTAL;
     if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
         $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
     }
     $uri = JURI::getInstance();
     $liveurlhost = $uri->toString(array("scheme", 'host', 'port'));
     if ($jshopConfig->admin_show_vendors) {
         $listVendors = $order->getVendors();
     } else {
         $listVendors = array();
     }
     $vendors_send_message = $jshopConfig->vendor_order_message_type == 1;
     $vendor_send_order = $jshopConfig->vendor_order_message_type == 2;
     $vendor_send_order_admin = $jshopConfig->vendor_order_message_type == 2 && $order->vendor_type == 0 && $order->vendor_id || $jshopConfig->vendor_order_message_type == 3;
     if ($vendor_send_order_admin) {
         $vendor_send_order = 0;
     }
     $admin_send_order = 1;
     if ($jshopConfig->admin_not_send_email_order_vendor_order && $vendor_send_order_admin && count($listVendors)) {
         $admin_send_order = 0;
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSendEmailsOrder', array(&$order, &$listVendors, &$file_generete_pdf_order, &$admin_send_order));
     //client message
     include_once JPATH_COMPONENT_SITE . "/views/checkout/view.html.php";
     $view_name = "checkout";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = new JshoppingViewCheckout($view_config);
     $view->setLayout("orderemail");
     $view->assign('client', 1);
     $view->assign('show_customer_info', 1);
     $view->assign('show_weight_order', 1);
     $view->assign('show_total_info', 1);
     $view->assign('show_payment_shipping_info', 1);
     $view->assign('config_fields', $config_fields);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('order_email_descr', $order_email_descr);
     $view->assign('order_email_descr_end', $order_email_descr_end);
     $view->assign('config', $jshopConfig);
     $view->assign('order', $order);
     $view->assign('products', $order->products);
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('text_total', $text_total);
     $view->assign('liveurlhost', $liveurlhost);
     $dispatcher->trigger('onBeforeCreateTemplateOrderMail', array(&$view));
     $message_client = $view->loadTemplate();
     //admin message
     $view_name = "checkout";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = new JshoppingViewCheckout($view_config);
     $view->setLayout("orderemail");
     $view->assign('client', 0);
     $view->assign('show_customer_info', 1);
     $view->assign('show_weight_order', 1);
     $view->assign('show_total_info', 1);
     $view->assign('show_payment_shipping_info', 1);
     $view->assign('config_fields', $config_fields);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('order_email_descr', $order_email_descr);
     $view->assign('order_email_descr_end', $order_email_descr_end);
     $view->assign('config', $jshopConfig);
     $view->assign('order', $order);
     $view->assign('products', $order->products);
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('text_total', $text_total);
     $view->assign('liveurlhost', $liveurlhost);
     $dispatcher->trigger('onBeforeCreateTemplateOrderMail', array(&$view));
     $message_admin = $view->loadTemplate();
     //vendors messages or order
     if ($vendors_send_message || $vendor_send_order) {
         foreach ($listVendors as $k => $datavendor) {
             if ($vendors_send_message) {
                 $show_customer_info = 0;
                 $show_weight_order = 0;
                 $show_total_info = 0;
                 $show_payment_shipping_info = 0;
             }
             if ($vendor_send_order) {
                 $show_customer_info = 1;
                 $show_weight_order = 0;
                 $show_total_info = 0;
                 $show_payment_shipping_info = 1;
             }
             $vendor_order_items = $order->getVendorItems($datavendor->id);
             $view_name = "checkout";
             $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
             $view = new JshoppingViewCheckout($view_config);
             $view->setLayout("orderemail");
             $view->assign('client', 0);
             $view->assign('show_customer_info', $show_customer_info);
             $view->assign('show_weight_order', $show_weight_order);
             $view->assign('show_total_info', $show_total_info);
             $view->assign('show_payment_shipping_info', $show_payment_shipping_info);
             $view->assign('config_fields', $config_fields);
             $view->assign('count_filed_delivery', $count_filed_delivery);
             $view->assign('order_email_descr', $order_email_descr);
             $view->assign('order_email_descr_end', $order_email_descr_end);
             $view->assign('config', $jshopConfig);
             $view->assign('order', $order);
             $view->assign('products', $vendor_order_items);
             $view->assign('show_percent_tax', $show_percent_tax);
             $view->assign('hide_subtotal', $hide_subtotal);
             $view->assign('noimage', $jshopConfig->noimage);
             $view->assign('text_total', $text_total);
             $view->assign('liveurlhost', $liveurlhost);
             $view->assign('show_customer_info', $vendor_send_order);
             $dispatcher->trigger('onBeforeCreateTemplateOrderPartMail', array(&$view));
             $message_vendor = $view->loadTemplate();
             $listVendors[$k]->message = $message_vendor;
         }
     }
     $pdfsend = 1;
     if ($jshopConfig->send_invoice_manually && !$manuallysend) {
         $pdfsend = 0;
     }
     if ($pdfsend && ($jshopConfig->order_send_pdf_client || $jshopConfig->order_send_pdf_admin)) {
         include_once $file_generete_pdf_order;
         $order->setInvoiceDate();
         $order->pdf_file = generatePdf($order, $jshopConfig);
         $order->insertPDF();
     }
     $mailfrom = $mainframe->getCfg('mailfrom');
     $fromname = $mainframe->getCfg('fromname');
     //send mail client
     if ($order->email) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($mailfrom, $fromname));
         $mailer->addRecipient($order->email);
         $mailer->setSubject(sprintf(_JSHOP_NEW_ORDER, $order->order_number, $order->f_name . " " . $order->l_name));
         $mailer->setBody($message_client);
         if ($pdfsend && $jshopConfig->order_send_pdf_client) {
             $mailer->addAttachment($jshopConfig->pdf_orders_path . "/" . $order->pdf_file);
         }
         $mailer->isHTML(true);
         $dispatcher->trigger('onBeforeSendOrderEmailClient', array(&$mailer, &$order, &$manuallysend, &$pdfsend));
         $send = $mailer->Send();
     }
     //send mail admin
     if ($admin_send_order) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($mailfrom, $fromname));
         $mailer->addRecipient(explode(',', $jshopConfig->contact_email));
         $mailer->setSubject(sprintf(_JSHOP_NEW_ORDER, $order->order_number, $order->f_name . " " . $order->l_name));
         $mailer->setBody($message_admin);
         if ($pdfsend && $jshopConfig->order_send_pdf_admin) {
             $mailer->addAttachment($jshopConfig->pdf_orders_path . "/" . $order->pdf_file);
         }
         $mailer->isHTML(true);
         $dispatcher->trigger('onBeforeSendOrderEmailAdmin', array(&$mailer, &$order, &$manuallysend, &$pdfsend));
         $send = $mailer->Send();
     }
     //send mail vendors
     if ($vendors_send_message || $vendor_send_order) {
         foreach ($listVendors as $k => $vendor) {
             $mailer = JFactory::getMailer();
             $mailer->setSender(array($mailfrom, $fromname));
             $mailer->addRecipient($vendor->email);
             $mailer->setSubject(sprintf(_JSHOP_NEW_ORDER_V, $order->order_number, ""));
             $mailer->setBody($vendor->message);
             $mailer->isHTML(true);
             $dispatcher->trigger('onBeforeSendOrderEmailVendor', array(&$mailer, &$order, &$manuallysend, &$pdfsend, &$vendor, &$vendors_send_message, &$vendor_send_order));
             $send = $mailer->Send();
         }
     }
     //vendor send order
     if ($vendor_send_order_admin) {
         foreach ($listVendors as $k => $vendor) {
             $mailer = JFactory::getMailer();
             $mailer->setSender(array($mailfrom, $fromname));
             $mailer->addRecipient($vendor->email);
             $mailer->setSubject(sprintf(_JSHOP_NEW_ORDER, $order->order_number, $order->f_name . " " . $order->l_name));
             $mailer->setBody($message_admin);
             if ($pdfsend && $jshopConfig->order_send_pdf_admin) {
                 $mailer->addAttachment($jshopConfig->pdf_orders_path . "/" . $order->pdf_file);
             }
             $mailer->isHTML(true);
             $dispatcher->trigger('onBeforeSendOrderEmailVendorOrder', array(&$mailer, &$order, &$manuallysend, &$pdfsend, &$vendor, &$vendors_send_message, &$vendor_send_order));
             $send = $mailer->Send();
         }
     }
     $dispatcher->trigger('onAfterSendEmailsOrder', array(&$order));
 }
Exemplo n.º 10
0
 function getDeliveryTime()
 {
     $cart = $this->getCart();
     $jshopConfig = JSFactory::getConfig();
     $sh_mt_pr = $this->getShippingMethodPrice();
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $deliverytimes[0] = '';
         $delivery_time = $deliverytimes[$sh_mt_pr->delivery_times_id];
         if (!$delivery_time && $jshopConfig->delivery_order_depends_delivery_product) {
             $delivery_time = $cart->getDelivery();
         }
     } else {
         $delivery_time = '';
     }
     return $delivery_time;
 }
Exemplo n.º 11
0
 function getDeliveryDaysProducts()
 {
     $deliverytimes = JSFactory::getAllDeliveryTime();
     $deliverytimesdays = JSFactory::getAllDeliveryTimeDays();
     $day = 0;
     foreach ($this->products as $prod) {
         if ($prod['delivery_times_id']) {
             if ($deliverytimesdays[$prod['delivery_times_id']] > $day) {
                 $day = $deliverytimesdays[$prod['delivery_times_id']];
             }
         }
     }
     return $day;
 }
Exemplo n.º 12
0
 function prepareOrderPrint($page = '', $date_format = 0)
 {
     $jshopConfig = JSFactory::getConfig();
     $lang = JSFactory::getLang();
     $jshopConfig->user_field_title[0] = '';
     $jshopConfig->user_field_client_type[0] = '';
     if ($page == 'order_show') {
         $this->status_name = $this->getStatus();
     } else {
         $this->status = $this->getStatus();
     }
     if (!isset($this->order_date_print)) {
         $this->order_date_print = formatdate($this->order_date);
         $this->order_datetime_print = formatdate($this->order_date, 1);
         if ($date_format) {
             $this->order_date = $this->order_date_print;
         }
     }
     $this->products = $this->getAllItems();
     $this->weight = $this->getWeightItems();
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         if (isset($deliverytimes[$this->delivery_times_id])) {
             $this->order_delivery_time = $deliverytimes[$this->delivery_times_id];
         } else {
             $this->order_delivery_time = '';
         }
         if ($this->order_delivery_time == "") {
             $this->order_delivery_time = $this->delivery_time;
         }
         if ($page == 'order_show') {
             $this->delivery_time_name = $this->order_delivery_time;
         }
     }
     $this->order_tax_list = $this->getTaxExt();
     if (!isset($this->country_id)) {
         $this->country_id = $this->country;
         $this->d_country_id = $this->d_country;
     }
     $country = JSFactory::getTable('country', 'jshop');
     $country->load($this->country_id);
     $this->country = $country->getName();
     $d_country = JSFactory::getTable('country', 'jshop');
     $d_country->load($this->d_country_id);
     $this->d_country = $d_country->getName();
     if ($jshopConfig->show_delivery_date && !datenull($this->delivery_date)) {
         $this->delivery_date_f = formatdate($this->delivery_date);
     } else {
         $this->delivery_date_f = '';
     }
     if (!isset($this->title_id)) {
         $this->title_id = $this->title;
         $this->d_title_id = $this->d_title;
     }
     if (!isset($this->birthday_date)) {
         $this->birthday_date = $this->birthday;
         $this->d_birthday_date = $this->d_birthday;
     }
     $this->title = $jshopConfig->user_field_title[$this->title_id];
     $this->d_title = $jshopConfig->user_field_title[$this->d_title_id];
     $this->birthday = getDisplayDate($this->birthday_date, $jshopConfig->field_birthday_format);
     $this->d_birthday = getDisplayDate($this->d_birthday_date, $jshopConfig->field_birthday_format);
     $this->client_type_name = $this->getClientTypeName();
     $shippingMethod = $this->getShipping();
     $pm_method = $this->getPayment();
     $paymentsysdata = $pm_method->getPaymentSystemData();
     $payment_system = $paymentsysdata->paymentSystem;
     if ($page == 'order_show') {
         $this->shipping_info = $shippingMethod->getName();
     } else {
         $this->shipping_information = $shippingMethod->getName();
     }
     $shippingForm = $shippingMethod->getShippingForm();
     if ($shippingForm) {
         $shippingForm->prepareParamsDispayMail($order, $shippingMethod);
     }
     $this->payment_name = $pm_method->getName();
     $this->payment_information = $this->payment_params;
     if ($payment_system) {
         $payment_system->prepareParamsDispayMail($order, $pm_method);
     }
     if ($pm_method->show_descr_in_email) {
         $this->payment_description = $pm_method->getDescription();
     } else {
         $this->payment_description = "";
     }
     if ($this->coupon_id) {
         $coupon = JSFactory::getTable('coupon', 'jshop');
         $coupon->load($this->coupon_id);
         $this->coupon_code = $coupon->coupon_code;
     }
     if ($page == 'order_show') {
         $this->history = $this->getHistory();
     }
     $this->prepareOrderPrint = 1;
 }
Exemplo n.º 13
0
 function step5()
 {
     $checkout = JSFactory::getModel('checkout', 'jshop');
     $checkout->checkStep(5);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadCheckoutStep5', array());
     appendPathWay(_JSHOP_CHECKOUT_PREVIEW);
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("checkout-preview");
     if ($seodata->title == "") {
         $seodata->title = _JSHOP_CHECKOUT_PREVIEW;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $cart = JSFactory::getModel('cart', 'jshop');
     $cart->load();
     $session = JFactory::getSession();
     $jshopConfig = JSFactory::getConfig();
     $user = JFactory::getUser();
     $adv_user = JSFactory::getUser();
     $sh_method = JSFactory::getTable('shippingMethod', 'jshop');
     $shipping_method_id = $cart->getShippingId();
     $sh_method->load($shipping_method_id);
     $sh_mt_pr = JSFactory::getTable('shippingMethodPrice', 'jshop');
     $sh_mt_pr->load($cart->getShippingPrId());
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $deliverytimes[0] = '';
         $delivery_time = $deliverytimes[$sh_mt_pr->delivery_times_id];
         if (!$delivery_time && $jshopConfig->delivery_order_depends_delivery_product) {
             $delivery_time = $cart->getDelivery();
         }
     } else {
         $delivery_time = '';
     }
     if ($jshopConfig->show_delivery_date) {
         $delivery_date = $cart->getDeliveryDate();
         if ($delivery_date) {
             $delivery_date = formatdate($cart->getDeliveryDate());
         }
     } else {
         $delivery_date = '';
     }
     $pm_method = JSFactory::getTable('paymentMethod', 'jshop');
     $payment_method_id = $cart->getPaymentId();
     $pm_method->load($payment_method_id);
     $lang = JSFactory::getLang();
     $field_country_name = $lang->get("name");
     $invoice_info = array();
     $country = JSFactory::getTable('country', 'jshop');
     $country->load($adv_user->country);
     $invoice_info['f_name'] = $adv_user->f_name;
     $invoice_info['l_name'] = $adv_user->l_name;
     $invoice_info['firma_name'] = $adv_user->firma_name;
     $invoice_info['street'] = $adv_user->street;
     $invoice_info['street_nr'] = $adv_user->street_nr;
     $invoice_info['zip'] = $adv_user->zip;
     $invoice_info['state'] = $adv_user->state;
     $invoice_info['city'] = $adv_user->city;
     $invoice_info['country'] = $country->{$field_country_name};
     $invoice_info['home'] = $adv_user->home;
     $invoice_info['apartment'] = $adv_user->apartment;
     if ($adv_user->delivery_adress) {
         $country = JSFactory::getTable('country', 'jshop');
         $country->load($adv_user->d_country);
         $delivery_info['f_name'] = $adv_user->d_f_name;
         $delivery_info['l_name'] = $adv_user->d_l_name;
         $delivery_info['firma_name'] = $adv_user->d_firma_name;
         $delivery_info['street'] = $adv_user->d_street;
         $delivery_info['street_nr'] = $adv_user->d_street_nr;
         $delivery_info['zip'] = $adv_user->d_zip;
         $delivery_info['state'] = $adv_user->d_state;
         $delivery_info['city'] = $adv_user->d_city;
         $delivery_info['country'] = $country->{$field_country_name};
         $delivery_info['home'] = $adv_user->d_home;
         $delivery_info['apartment'] = $adv_user->d_apartment;
     } else {
         $delivery_info = $invoice_info;
     }
     $no_return = 0;
     if ($jshopConfig->return_policy_for_product) {
         $cart_products = array();
         foreach ($cart->products as $products) {
             $cart_products[] = $products['product_id'];
         }
         $cart_products = array_unique($cart_products);
         $_product_option = JSFactory::getTable('productOption', 'jshop');
         $list_no_return = $_product_option->getProductOptionList($cart_products, 'no_return');
         $no_return = intval(in_array('1', $list_no_return));
     }
     if ($jshopConfig->no_return_all) {
         $no_return = 1;
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields['address'];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $checkout_navigator = $checkout->showCheckoutNavigation(5);
     $small_cart = $checkout->showSmallCart(5);
     $view_name = "checkout";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("previewfinish");
     $dispatcher->trigger('onBeforeDisplayCheckoutStep5', array(&$sh_method, &$pm_method, &$delivery_info, &$cart, &$view));
     $lang = JSFactory::getLang();
     $name = $lang->get("name");
     $sh_method->name = $sh_method->{$name};
     $view->assign('no_return', $no_return);
     $view->assign('sh_method', $sh_method);
     $view->assign('payment_name', $pm_method->{$name});
     $view->assign('delivery_info', $delivery_info);
     $view->assign('invoice_info', $invoice_info);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5save', 0, 0, $jshopConfig->use_ssl));
     $view->assign('config', $jshopConfig);
     $view->assign('delivery_time', $delivery_time);
     $view->assign('delivery_date', $delivery_date);
     $view->assign('checkout_navigator', $checkout_navigator);
     $view->assign('small_cart', $small_cart);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $dispatcher->trigger('onBeforeDisplayCheckoutStep5View', array(&$view));
     $view->display();
 }