コード例 #1
0
ファイル: functions.php プロジェクト: JexyRu/jshop-updates
function xhtmlUrl($url, $filter = 1)
{
    if ($filter) {
        $url = jsFilterUrl($url);
    }
    $url = str_replace("&", "&", $url);
    return $url;
}
コード例 #2
0
ファイル: product.php プロジェクト: olegverstka/monax.dev
 function display($cachable = false, $urlparams = false)
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ajax = JRequest::getInt('ajax');
     $jshopConfig = JSFactory::getConfig();
     $user = JFactory::getUser();
     JSFactory::loadJsFilesLightBox();
     $session = JFactory::getSession();
     $tmpl = JRequest::getVar("tmpl");
     if ($tmpl != "component") {
         $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     }
     $product_id = JRequest::getInt('product_id');
     $category_id = JRequest::getInt('category_id');
     $attr = JRequest::getVar("attr");
     $back_value = $session->get('product_back_value');
     if (!isset($back_value['pid'])) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if ($back_value['pid'] != $product_id) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if (!is_array($back_value['attr'])) {
         $back_value['attr'] = array();
     }
     if (count($back_value['attr']) == 0 && is_array($attr)) {
         $back_value['attr'] = $attr;
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProduct', array(&$product_id, &$category_id, &$back_value));
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JSFactory::getTable('product', 'jshop');
     $product->load($product_id);
     $listcategory = $product->getCategories(1);
     if (!getDisplayPriceForProduct($product->product_price)) {
         $jshopConfig->attr_display_addprice = 0;
     }
     $attributesDatas = $product->getAttributesDatas($back_value['attr']);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
     if (count($attributes)) {
         $_attributevalue = JSFactory::getTable('AttributValue', 'jshop');
         $all_attr_values = $_attributevalue->getAllAttributeValues();
     } else {
         $all_attr_values = array();
     }
     $session->set('product_back_value', array());
     $product->getExtendsData();
     $category = JSFactory::getTable('category', 'jshop');
     $category->load($category_id);
     $category->name = $category->getName();
     $dispatcher->trigger('onBeforeCheckProductPublish', array(&$product, &$category, &$category_id, &$listcategory));
     if ($category->category_publish == 0 || $product->product_publish == 0 || !in_array($product->access, $user->getAuthorisedViewLevels()) || !in_array($category_id, $listcategory)) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathway($category->getTreeChild(), 'product');
     }
     appendPathWay($product->name);
     if ($product->meta_title == "") {
         $product->meta_title = $product->name;
     }
     setMetaData($product->meta_title, $product->meta_keyword, $product->meta_description);
     $product->hit();
     $product->product_basic_price_unit_qty = 1;
     if ($jshopConfig->admin_show_product_basic_price) {
         $product->getBasicPriceInfo();
     } else {
         $product->product_basic_price_show = 0;
     }
     $view_name = "product";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     if ($product->product_template == "") {
         $product->product_template = "default";
     }
     $view->setLayout("product_" . $product->product_template);
     $_review = JSFactory::getTable('review', 'jshop');
     if (($allow_review = $_review->getAllowReview()) > 0) {
         $arr_marks = array();
         $arr_marks[] = JHTML::_('select.option', '0', _JSHOP_NOT, 'mark_id', 'mark_value');
         for ($i = 1; $i <= $jshopConfig->max_mark; $i++) {
             $arr_marks[] = JHTML::_('select.option', $i, $i, 'mark_id', 'mark_value');
         }
         $text_review = '';
         $select_review = JHTML::_('select.genericlist', $arr_marks, 'mark', 'class="inputbox" size="1"', 'mark_id', 'mark_value');
     } else {
         $select_review = '';
         $text_review = $_review->getText();
     }
     if ($allow_review) {
         JSFactory::loadJsFilesRating();
     }
     if ($jshopConfig->product_show_manufacturer_logo || $jshopConfig->product_show_manufacturer) {
         $product->manufacturer_info = $product->getManufacturerInfo();
         if (!isset($product->manufacturer_info)) {
             $product->manufacturer_info = new stdClass();
             $product->manufacturer_info->manufacturer_logo = '';
             $product->manufacturer_info->name = '';
         }
     } else {
         $product->manufacturer_info = new stdClass();
         $product->manufacturer_info->manufacturer_logo = '';
         $product->manufacturer_info->name = '';
     }
     if ($jshopConfig->product_show_vendor) {
         $vendorinfo = $product->getVendorInfo();
         $vendorinfo->urllistproducts = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendorinfo->id, 1);
         $vendorinfo->urlinfo = SEFLink("index.php?option=com_jshopping&controller=vendor&task=info&vendor_id=" . $vendorinfo->id, 1);
         $product->vendor_info = $vendorinfo;
     } else {
         $product->vendor_info = null;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $product->extra_field = $product->getExtraFields();
     } else {
         $product->extra_field = null;
     }
     if ($jshopConfig->admin_show_freeattributes) {
         $product->getListFreeAttributes();
         foreach ($product->freeattributes as $k => $v) {
             if (!isset($back_value['freeattr'][$v->id])) {
                 $back_value['freeattr'][$v->id] = '';
             }
             $product->freeattributes[$k]->input_field = '<input type="text" class="inputbox" size="40" name="freeattribut[' . $v->id . ']" value="' . $back_value['freeattr'][$v->id] . '" />';
         }
         $attrrequire = $product->getRequireFreeAttribute();
         $product->freeattribrequire = count($attrrequire);
     } else {
         $product->freeattributes = null;
         $product->freeattribrequire = 0;
     }
     if ($jshopConfig->product_show_qty_stock) {
         $product->qty_in_stock = getDataProductQtyInStock($product);
     }
     if (!$jshopConfig->admin_show_product_labels) {
         $product->label_id = null;
     }
     if ($product->label_id) {
         $image = getNameImageLabel($product->label_id);
         if ($image) {
             $product->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
         }
         $product->_label_name = getNameImageLabel($product->label_id, 2);
     }
     $hide_buy = 0;
     if ($jshopConfig->user_as_catalog) {
         $hide_buy = 1;
     }
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->product_quantity <= 0) {
         $hide_buy = 1;
     }
     $available = "";
     if ($product->getQty() <= 0 && $product->product_quantity > 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE_THIS_OPTION;
     } elseif ($product->product_quantity <= 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE;
     }
     $product->_display_price = getDisplayPriceForProduct($product->getPriceCalculate());
     if (!$product->_display_price) {
         $product->product_old_price = 0;
         $product->product_price_default = 0;
         $product->product_basic_price_show = 0;
         $product->product_is_add_price = 0;
         $product->product_tax = 0;
         $jshopConfig->show_plus_shipping_in_product = 0;
     }
     if (!$product->_display_price) {
         $hide_buy = 1;
     }
     $default_count_product = 1;
     if ($jshopConfig->min_count_order_one_product > 1) {
         $default_count_product = $jshopConfig->min_count_order_one_product;
     }
     if ($back_value['qty']) {
         $default_count_product = $back_value['qty'];
     }
     if (trim($product->description) == "") {
         $product->description = $product->short_description;
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($product, "product");
     }
     $product->hide_delivery_time = 0;
     if (!$product->getDeliveryTimeId()) {
         $product->hide_delivery_time = 1;
     }
     $product->button_back_js_click = "history.go(-1);";
     if ($session->get('jshop_end_page_list_product') && $jshopConfig->product_button_back_use_end_list) {
         $product->button_back_js_click = "location.href='" . jsFilterUrl($session->get('jshop_end_page_list_product')) . "';";
     }
     $displaybuttons = '';
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->getQty() <= 0) {
         $displaybuttons = 'display:none;';
     }
     $product_images = $product->getImages();
     $product_videos = $product->getVideos();
     $product_demofiles = $product->getDemoFiles();
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$product->product_related));
     $dispatcher->trigger('onBeforeDisplayProduct', array(&$product, &$view, &$product_images, &$product_videos, &$product_demofiles));
     $view->assign('config', $jshopConfig);
     $view->assign('image_path', $jshopConfig->live_path . '/images');
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('video_product_path', $jshopConfig->video_product_live_path);
     $view->assign('video_image_preview_path', $jshopConfig->video_product_live_path);
     $view->assign('product', $product);
     $view->assign('category_id', $category_id);
     $view->assign('images', $product_images);
     $view->assign('videos', $product_videos);
     $view->assign('demofiles', $product_demofiles);
     $view->assign('attributes', $attributes);
     $view->assign('all_attr_values', $all_attr_values);
     $view->assign('related_prod', $product->product_related);
     $view->assign('path_to_image', $jshopConfig->live_path . 'images/');
     $view->assign('live_path', JURI::root());
     $view->assign('enable_wishlist', $jshopConfig->enable_wishlist);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=cart&task=add', 1));
     $view->assign('urlupdateprice', SEFLink('index.php?option=com_jshopping&controller=product&task=ajax_attrib_select_and_price&product_id=' . $product_id . '&ajax=1', 1, 1));
     if ($allow_review) {
         $context = "jshoping.list.front.product.review";
         $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', 20, 'int');
         $limitstart = JRequest::getInt('limitstart');
         $total = $product->getReviewsCount();
         $view->assign('reviews', $product->getReviews($limitstart, $limit));
         jimport('joomla.html.pagination');
         $pagination = new JPagination($total, $limitstart, $limit);
         $pagenav = $pagination->getPagesLinks();
         $view->assign('pagination', $pagenav);
         $view->assign('pagination_obj', $pagination);
         $view->assign('display_pagination', $pagenav != "");
     }
     $view->assign('allow_review', $allow_review);
     $view->assign('select_review', $select_review);
     $view->assign('text_review', $text_review);
     $view->assign('stars_count', floor($jshopConfig->max_mark / $jshopConfig->rating_starparts));
     $view->assign('parts_count', $jshopConfig->rating_starparts);
     $view->assign('user', $user);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $view->assign('hide_buy', $hide_buy);
     $view->assign('available', $available);
     $view->assign('default_count_product', $default_count_product);
     $view->assign('folder_list_products', "list_products");
     $view->assign('back_value', $back_value);
     $view->assign('displaybuttons', $displaybuttons);
     $dispatcher->trigger('onBeforeDisplayProductView', array(&$view));
     $view->display();
     $dispatcher->trigger('onAfterDisplayProduct', array(&$product));
     if ($ajax) {
         die;
     }
 }
コード例 #3
0
ファイル: review.php プロジェクト: olegverstka/monax.dev
        <span class="review"><?php 
        print _JSHOP_ADD_REVIEW_PRODUCT;
        ?>
</span>
        
        <form action="<?php 
        print SEFLink('index.php?option=com_jshopping&controller=product&task=reviewsave');
        ?>
" name="add_review" method="post" onsubmit="return validateReviewForm(this.name)">
        
            <input type="hidden" name="product_id" value="<?php 
        print $this->product->product_id;
        ?>
" />
            <input type="hidden" name="back_link" value="<?php 
        print jsFilterUrl($_SERVER['REQUEST_URI']);
        ?>
" />
		    <?php 
        echo JHtml::_('form.token');
        ?>
            
            <div id="jshop_review_write" >
                <div class = "row-fluid">
                    <div class = "span3">
                        <?php 
        print _JSHOP_REVIEW_USER_NAME;
        ?>
                    </div>
                    <div class = "span9">
                        <input type="text" name="user_name" id="review_user_name" class="inputbox" value="<?php 
コード例 #4
0
 public function prepareView($back_value = array())
 {
     $jshopConfig = JSFactory::getConfig();
     $product = $this->product;
     if (!getDisplayPriceForProduct($product->product_price)) {
         $jshopConfig->attr_display_addprice = 0;
     }
     $back_value_attr = (array) $back_value['attr'];
     $this->attributes = $product->getInitLoadAttribute($back_value_attr);
     if (count($this->attributes)) {
         $_attributevalue = JSFactory::getTable('AttributValue', 'jshop');
         $this->all_attr_values = $_attributevalue->getAllAttributeValues();
     } else {
         $this->all_attr_values = array();
     }
     $product->getExtendsData();
     $product->product_basic_price_unit_qty = 1;
     if ($jshopConfig->admin_show_product_basic_price) {
         $product->getBasicPriceInfo();
     } else {
         $product->product_basic_price_show = 0;
     }
     if ($product->product_template == "") {
         $product->product_template = "default";
     }
     $_review = JSFactory::getTable('review', 'jshop');
     $this->allow_review = $_review->getAllowReview();
     if ($this->allow_review > 0) {
         $arr_marks = array();
         $arr_marks[] = JHTML::_('select.option', '0', _JSHOP_NOT, 'mark_id', 'mark_value');
         for ($i = 1; $i <= $jshopConfig->max_mark; $i++) {
             $arr_marks[] = JHTML::_('select.option', $i, $i, 'mark_id', 'mark_value');
         }
         $this->text_review = '';
         $this->select_review = JHTML::_('select.genericlist', $arr_marks, 'mark', 'class="inputbox"', 'mark_id', 'mark_value');
     } else {
         $this->select_review = '';
         $this->text_review = $_review->getText();
     }
     if ($jshopConfig->product_show_manufacturer_logo || $jshopConfig->product_show_manufacturer) {
         $product->manufacturer_info = $product->getManufacturerInfo();
         if (!isset($product->manufacturer_info)) {
             $product->manufacturer_info = new stdClass();
             $product->manufacturer_info->manufacturer_logo = '';
             $product->manufacturer_info->name = '';
         }
     } else {
         $product->manufacturer_info = new stdClass();
         $product->manufacturer_info->manufacturer_logo = '';
         $product->manufacturer_info->name = '';
     }
     if ($jshopConfig->product_show_vendor) {
         $vendorinfo = $product->getVendorInfo();
         $vendorinfo->urllistproducts = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendorinfo->id, 1);
         $vendorinfo->urlinfo = SEFLink("index.php?option=com_jshopping&controller=vendor&task=info&vendor_id=" . $vendorinfo->id, 1);
         $product->vendor_info = $vendorinfo;
     } else {
         $product->vendor_info = null;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $product->extra_field = $product->getExtraFields();
     } else {
         $product->extra_field = null;
     }
     if ($jshopConfig->admin_show_freeattributes) {
         $product->getListFreeAttributes();
         foreach ($product->freeattributes as $k => $v) {
             if (!isset($back_value['freeattr'][$v->id])) {
                 $back_value['freeattr'][$v->id] = '';
             }
             $product->freeattributes[$k]->input_field = $this->getInputFreeAttribute($v->id, $back_value['freeattr'][$v->id]);
         }
         $attrrequire = $product->getRequireFreeAttribute();
         $product->freeattribrequire = count($attrrequire);
     } else {
         $product->freeattributes = null;
         $product->freeattribrequire = 0;
     }
     if ($jshopConfig->product_show_qty_stock) {
         $product->qty_in_stock = getDataProductQtyInStock($product);
     }
     if (!$jshopConfig->admin_show_product_labels) {
         $product->label_id = null;
     }
     if ($product->label_id) {
         $image = getNameImageLabel($product->label_id);
         if ($image) {
             $product->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
         }
         $product->_label_name = getNameImageLabel($product->label_id, 2);
     }
     $product->_display_price = getDisplayPriceForProduct($product->getPriceCalculate());
     if (!$product->_display_price) {
         $product->product_old_price = 0;
         $product->product_price_default = 0;
         $product->product_basic_price_show = 0;
         $product->product_is_add_price = 0;
         $product->product_tax = 0;
         $jshopConfig->show_plus_shipping_in_product = 0;
     }
     if (trim($product->description) == "") {
         $product->description = $product->short_description;
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($product, "product");
     }
     $product->hide_delivery_time = 0;
     if (!$product->getDeliveryTimeId()) {
         $product->hide_delivery_time = 1;
     }
     $product->button_back_js_click = "history.go(-1);";
     $end_page_list = $this->getEndPageList();
     if ($end_page_list && $jshopConfig->product_button_back_use_end_list) {
         $product->button_back_js_click = "location.href='" . jsFilterUrl($end_page_list) . "';";
     }
 }