当前位置: 首页>>代码示例>>PHP>>正文


PHP producthelper::getProductAccessory方法代码示例

本文整理汇总了PHP中producthelper::getProductAccessory方法的典型用法代码示例。如果您正苦于以下问题:PHP producthelper::getProductAccessory方法的具体用法?PHP producthelper::getProductAccessory怎么用?PHP producthelper::getProductAccessory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在producthelper的用法示例。


在下文中一共展示了producthelper::getProductAccessory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

 $template_d1 = explode("{product_loop_start}", $data_add);
 $template_d2 = explode("{product_loop_end}", $template_d1[1]);
 $template_product = $template_d2[0];
 $attribute_template = $producthelper->getAttributeTemplate($template_product);
 $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1);
 $product_data = '';
 $prddata_add = "";
 $this->product = $model->getCategorylistProduct($row->category_id);
 for ($j = 0; $j < count($this->product); $j++) {
     $product = $this->product[$j];
     if (!is_object($product)) {
         break;
     }
     $count_no_user_field = 0;
     // Counting accessory
     $accessorylist = $producthelper->getProductAccessory(0, $product->product_id);
     $totacc = count($accessorylist);
     $prddata_add .= $template_product;
     // Product User Field Start
     $hidden_userfield = "";
     $returnArr = $producthelper->getProductUserfieldFromTemplate($prddata_add);
     $template_userfield = $returnArr[0];
     $userfieldArr = $returnArr[1];
     if ($template_userfield != "") {
         $ufield = "";
         for ($ui = 0; $ui < count($userfieldArr); $ui++) {
             $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $product->product_id);
             $ufield .= $product_userfileds[1];
             if ($product_userfileds[1] != "") {
                 $count_no_user_field++;
             }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: getProductItemInfo

 public function getProductItemInfo($product_id = 0, $quantity = 1, $unique_id = "", $user_id = 0, $newproduct_price = 0)
 {
     $producthelper = new producthelper();
     $wrapperlist = "";
     $accessorylist = "";
     $attributelist = "";
     $productuserfield = "";
     $product_price = 0;
     $product_price_excl_vat = 0;
     $producttax = 0;
     if ($product_id) {
         $productInfo = $producthelper->getProductById($product_id);
         if ($newproduct_price != 0) {
             $product_price_excl_vat = $newproduct_price;
             $producttax = $producthelper->getProductTax($product_id, $newproduct_price, $user_id);
         } else {
             $productArr = $producthelper->getProductNetPrice($product_id, $user_id, $quantity);
             $product_price_excl_vat = $productArr['productPrice'];
             $producttax = $productArr['productVat'];
             // Attribute start
             $attributes_set = array();
             if ($productInfo->attribute_set_id > 0) {
                 $attributes_set = $producthelper->getProductAttribute(0, $productInfo->attribute_set_id, 0, 1);
             }
             $attributes = $producthelper->getProductAttribute($product_id);
             $attributes = array_merge($attributes, $attributes_set);
             $attributelist = $this->replaceAttributeData($product_id, 0, $attributes, $user_id, $unique_id);
             // Accessory start
             $accessory = $producthelper->getProductAccessory(0, $product_id);
             $accessorylist = $this->replaceAccessoryData($product_id, $accessory, $user_id, $unique_id);
             // Wrapper selection box generate
             $wrapperlist = $this->replaceWrapperData($product_id, $user_id, $unique_id);
             $productuserfield = $this->replaceUserfield($product_id, $productInfo->product_template, $unique_id);
         }
     }
     $product_price = $product_price_excl_vat + $producttax;
     $total_price = $product_price * $quantity;
     $totaltax = $producttax * $quantity;
     $displayrespoce = "";
     $displayrespoce .= "<div id='product_price_excl_vat'>" . $product_price_excl_vat . "</div>";
     $displayrespoce .= "<div id='product_tax'>" . $producttax . "</div>";
     $displayrespoce .= "<div id='product_price'>" . $product_price . "</div>";
     $displayrespoce .= "<div id='total_price'>" . $total_price . "</div>";
     $displayrespoce .= "<div id='total_tax'>" . $totaltax . "</div>";
     $displayrespoce .= "<div id='attblock'><table>" . $attributelist . "</table></div>";
     $displayrespoce .= "<div id='productuserfield'><table>" . $productuserfield . "</table></div>";
     $displayrespoce .= "<div id='accessoryblock'><table>" . $accessorylist . "</table></div>";
     $displayrespoce .= "<div id='noteblock'>" . $wrapperlist . "</div>";
     return $displayrespoce;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:50,代码来源:product.php

示例3: add

 /**
  * Method to add product in cart
  *
  * @return void
  */
 public function add()
 {
     $app = JFactory::getApplication();
     $option = JRequest::getVar('option');
     $post = JRequest::get('post');
     $parent_accessory_productid = $post['product_id'];
     $Itemid = JRequest::getVar('Itemid');
     $producthelper = new producthelper();
     $redhelper = new redhelper();
     $Itemid = $redhelper->getCartItemid();
     $model = $this->getModel('cart');
     // Call add method of modal to store product in cart session
     $userfiled = JRequest::getVar('userfiled');
     JPluginHelper::importPlugin('redshop_product');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeAddProductToCart', array(&$post));
     $result = $this->_carthelper->addProductToCart($post);
     if (is_bool($result) && $result) {
     } else {
         $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART");
         if (AJAX_CART_BOX == 1) {
             echo "`0`" . $errmsg;
             die;
         } else {
             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);
             if (count($ItemData) > 0) {
                 $prdItemid = $ItemData->id;
             } else {
                 $prdItemid = $redhelper->getItemid($post['product_id']);
             }
             $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false);
             $app->Redirect($link, $errmsg);
         }
     }
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     if (isset($cart['AccessoryAsProduct'])) {
         $attArr = $cart['AccessoryAsProduct'];
         if (ACCESSORY_AS_PRODUCT_IN_CART_ENABLE) {
             $data['accessory_data'] = $attArr[0];
             $data['acc_quantity_data'] = $attArr[1];
             $data['acc_attribute_data'] = $attArr[2];
             $data['acc_property_data'] = $attArr[3];
             $data['acc_subproperty_data'] = $attArr[4];
             if (isset($data['accessory_data']) && ($data['accessory_data'] != "" && $data['accessory_data'] != 0)) {
                 $accessory_data = explode("@@", $data['accessory_data']);
                 $acc_quantity_data = explode("@@", $data['acc_quantity_data']);
                 $acc_attribute_data = explode("@@", $data['acc_attribute_data']);
                 $acc_property_data = explode("@@", $data['acc_property_data']);
                 $acc_subproperty_data = explode("@@", $data['acc_subproperty_data']);
                 for ($i = 0; $i < count($accessory_data); $i++) {
                     $accessory = $producthelper->getProductAccessory($accessory_data[$i]);
                     $post = array();
                     $post['parent_accessory_product_id'] = $parent_accessory_productid;
                     $post['product_id'] = $accessory[0]->child_product_id;
                     $post['quantity'] = $acc_quantity_data[$i];
                     $post['category_id'] = 0;
                     $post['sel_wrapper_id'] = 0;
                     $post['attribute_data'] = $acc_attribute_data[$i];
                     $post['property_data'] = $acc_property_data[$i];
                     $post['subproperty_data'] = $acc_subproperty_data[$i];
                     $result = $this->_carthelper->addProductToCart($post);
                     $cart = $session->get('cart');
                     if (is_bool($result) && $result) {
                     } else {
                         $errmsg = $result ? $result : JText::_("COM_REDSHOP_PRODUCT_NOT_ADDED_TO_CART");
                         if (JError::isError(JError::getError())) {
                             $error = JError::getError();
                             $errmsg = $error->message;
                         }
                         if (AJAX_CART_BOX == 1) {
                             echo "`0`" . $errmsg;
                             die;
                         } else {
                             $ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $post['product_id']);
                             if (count($ItemData) > 0) {
                                 $prdItemid = $ItemData->id;
                             } else {
                                 $prdItemid = $redhelper->getItemid($post['product_id']);
                             }
                             $link = JRoute::_("index.php?option=" . $option . "&view=product&pid=" . $post["product_id"] . "&Itemid=" . $prdItemid, false);
                             $app->Redirect($link, $errmsg);
                         }
                     }
                 }
             }
         }
         if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
             $this->_carthelper->carttodb();
         }
         $this->_carthelper->cartFinalCalculation();
         unset($cart['AccessoryAsProduct']);
     } else {
         if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
             $this->_carthelper->carttodb();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: array

 }
 if ($show_readmore) {
     echo "<div class='mod_redshop_products_readmore'><a href='" . $link . "'>" . JText::_('COM_REDSHOP_TXT_READ_MORE') . "</a>&nbsp;</div>";
 }
 if ($show_addtocart) {
     // Product attribute  Start
     $attributes_set = array();
     if ($row->attribute_set_id > 0) {
         $attributes_set = $producthelper->getProductAttribute(0, $row->attribute_set_id, 0, 1);
     }
     $attributes = $producthelper->getProductAttribute($row->product_id);
     $attributes = array_merge($attributes, $attributes_set);
     $totalatt = count($attributes);
     // Product attribute  End
     // Product accessory Start
     $accessory = $producthelper->getProductAccessory(0, $row->product_id);
     $totalAccessory = count($accessory);
     // Product accessory End
     /*
      * collecting extra fields
      */
     $count_no_user_field = 0;
     $hidden_userfield = "";
     $userfieldArr = array();
     if (AJAX_CART_BOX) {
         $ajax_detail_template_desc = "";
         $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($row);
         if (count($ajax_detail_template) > 0) {
             $ajax_detail_template_desc = $ajax_detail_template->template_desc;
         }
         $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc);
开发者ID:,项目名称:,代码行数:31,代码来源:

示例5: display

 public function display($tpl = null)
 {
     $redTemplate = new Redtemplate();
     $product_category = new product_category();
     $producthelper = new producthelper();
     $option = JRequest::getVar('option');
     $this->setLayout('default');
     $uri = JFactory::getURI();
     $model = $this->getModel('category_detail');
     $categories = $model->getcategories();
     JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY_MANAGEMENT_DETAIL'), 'redshop_categories48');
     $document = JFactory::getDocument();
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/fields.js');
     $document->addScript('components/' . $option . '/assets/js/select_sort.js');
     $document->addScript('components/' . $option . '/assets/js/json.js');
     $document->addStyleSheet('components/com_redshop/assets/css/search.css');
     $document->addScript('components/com_redshop/assets/js/search.js');
     $document->addScript('components/com_redshop/assets/js/related.js');
     $detail = $this->get('data');
     $isNew = $detail->category_id < 1;
     // Assign default values for new categories
     if ($isNew) {
         $detail->append_to_global_seo = 'append';
         $detail->canonical_url = '';
     }
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : $detail->category_name . " - " . JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_categories48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::save2new();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $lists = array();
     /*
      * get total Template from configuration helper
      */
     $templates = $redTemplate->getTemplate('category');
     /*
      * multiple select box for
      * 	Front-End category Template Selector
      */
     if (strstr($detail->category_more_template, ",")) {
         $category_more_template = explode(",", $detail->category_more_template);
     } else {
         $category_more_template = $detail->category_more_template;
     }
     $lists['category_more_template'] = JHTML::_('select.genericlist', $templates, 'category_more_template[]', 'class="inputbox" multiple="multiple" size="10" ', 'template_id', 'template_name', $category_more_template);
     $append_to_global_seo = array();
     $append_to_global_seo[] = JHTML::_('select.option', 'append', JText::_('COM_REDSHOP_APPEND_TO_GLOBAL_SEO'));
     $append_to_global_seo[] = JHTML::_('select.option', 'prepend', JText::_('COM_REDSHOP_PREPEND_TO_GLOBAL_SEO'));
     $append_to_global_seo[] = JHTML::_('select.option', 'replace', JText::_('COM_REDSHOP_REPLACE_TO_GLOBAL_SEO'));
     $lists['append_to_global_seo'] = JHTML::_('select.genericlist', $append_to_global_seo, 'append_to_global_seo', 'class="inputbox" size="1" ', 'value', 'text', $detail->append_to_global_seo);
     // Merging select option in the select box
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->template_id = 0;
     $temps[0]->template_name = JText::_('COM_REDSHOP_SELECT');
     $templates = @array_merge($temps, $templates);
     $lists['category_template'] = JHTML::_('select.genericlist', $templates, 'category_template', 'class="inputbox" size="1"  onchange="select_dynamic_field(this.value,\'' . $detail->category_id . '\',\'2\');" ', 'template_id', 'template_name', $detail->category_template);
     /*
      * class name product_category
      * from helper/category.php
      * get select box for select category parent Id
      */
     $categories = $product_category->list_all("category_parent_id", $detail->category_id);
     $lists['categories'] = $categories;
     // Select box for ProductCompareTemplate
     $comparetemplate = $redTemplate->getTemplate('compare_product');
     $temp = array();
     $temp[0] = new stdClass();
     $temp[0]->template_id = 0;
     $temp[0]->template_name = JText::_('COM_REDSHOP_SELECT');
     $comparetemplate = @array_merge($temp, $comparetemplate);
     $lists['compare_template_id'] = JHTML::_('select.genericlist', $comparetemplate, 'compare_template_id', 'class="inputbox" size="1" ', 'template_id', 'template_name', $detail->compare_template_id);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     // Accessory of Category
     $categroy_accessory_product = array();
     if ($detail->category_id) {
         $categroy_accessory_product = $producthelper->getProductAccessory(0, 0, 0, $detail->category_id);
     }
     $lists['categroy_accessory_product'] = $categroy_accessory_product;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:90,代码来源:view.html.php

示例6: display_products


//.........这里部分代码省略.........
                }
                $wishlist_data = str_replace('{product_price}', $mainproduct_price, $wishlist_data);
            }
            // Product User Field Start
            $count_no_user_field = 0;
            $returnArr = $producthelper->getProductUserfieldFromTemplate($wishlist_data);
            $template_userfield = $returnArr[0];
            $userfieldArr = $returnArr[1];
            if (strstr($wishlist_data, "{if product_userfield}") && strstr($wishlist_data, "{product_userfield end if}") && $template_userfield != "") {
                $ufield = "";
                $cart = $session->get('cart');
                if (isset($cart['idx'])) {
                    $idx = (int) $cart['idx'];
                }
                $idx = 0;
                $cart_id = '';
                for ($j = 0; $j < $idx; $j++) {
                    if ($cart[$j]['product_id'] == $row->product_id) {
                        $cart_id = $j;
                    }
                }
                for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                    if (!$idx) {
                        $cart_id = "";
                    }
                    $mysesspro = "productuserfield_" . $ui;
                    for ($check_i = 1; $check_i <= $_SESSION["no_of_prod"]; $check_i++) {
                        if ($_SESSION['wish_' . $check_i]->product_id == $row->product_id) {
                            $product_userfileds_final = $_SESSION['wish_' . $check_i]->{$mysesspro};
                        }
                    }
                    if ($product_userfileds_final != '') {
                        $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $row->product_id, $product_userfileds_final, 1);
                    } else {
                        $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', $cart_id, 0, $row->product_id);
                    }
                    $ufield .= $product_userfileds[1];
                    //
                    if ($product_userfileds[1] != "") {
                        $count_no_user_field++;
                    }
                    if ($product_userfileds_final != '') {
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data);
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data);
                    } else {
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $wishlist_data);
                        $wishlist_data = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $wishlist_data);
                    }
                }
                $product_userfileds_form = "<form method='post' action='' id='user_fields_form' name='user_fields_form'>";
                if ($ufield != "") {
                    $wishlist_data = str_replace("{if product_userfield}", $product_userfileds_form, $wishlist_data);
                    $wishlist_data = str_replace("{product_userfield end if}", "</form>", $wishlist_data);
                } else {
                    $wishlist_data = str_replace("{if product_userfield}", "", $wishlist_data);
                    $wishlist_data = str_replace("{product_userfield end if}", "", $wishlist_data);
                }
            }
            // Product User Field End
            /////////////////////////////////// Product accessory Start /////////////////////////////////
            $accessory = $producthelper->getProductAccessory(0, $row->product_id);
            $totalAccessory = count($accessory);
            $wishlist_data = $producthelper->replaceAccessoryData($row->product_id, 0, $accessory, $wishlist_data, $isChilds);
            /////////////////////////////////// Product accessory End /////////////////////////////////
            $wishlist_data = str_replace('{product_name}', $pname, $wishlist_data);
            $wishlist_data = str_replace('{product_number}', $pnumber, $wishlist_data);
            $wishlist_data = str_replace('{product_s_desc}', $pdesc, $wishlist_data);
            $wishlist_data = $producthelper->getExtraSectionTag($extraFieldName, $row->product_id, "1", $wishlist_data, 1);
            $wishlist_data = $producthelper->replaceCartTemplate($row->product_id, $row->category_id, 0, 0, $wishlist_data, $isChilds, $userfieldArr, $totalatt, $totalAccessory, $count_no_user_field);
            $rmore = "<a href='" . $link . "' title='" . $row->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
            $wishlist_data = str_replace("{read_more}", $rmore, $wishlist_data);
            $wishlist_data = str_replace("{read_more_link}", $link, $wishlist_data);
            $wishlist_data = str_replace("{product_loop_start}", '', $wishlist_data);
            $wishlist_data = str_replace("{product_loop_end}", '', $wishlist_data);
            $wishlist_data = str_replace("{back_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{back_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{mail_link}", '', $wishlist_data);
            $wishlist_data = str_replace("{if product_on_sale}", '', $wishlist_data);
            $wishlist_data = str_replace("{product_on_sale end if}", '', $wishlist_data);
            $wishlist_data = str_replace("<table></table>", '', $wishlist_data);
            $wishlist_data = str_replace("{all_cart}", '', $wishlist_data);
            $wishlist_data = str_replace("{if product_on_sale}", "", $wishlist_data);
            $wishlist_data = str_replace("{product_on_sale end if}", "", $wishlist_data);
            $regdellink = JRoute::_("index.php?mydel=1&view=wishlist&wishlist_id=" . $row->product_id . "&task=mysessdelwishlist");
            $mainregdellink = "<div><a href=\"" . $regdellink . "\">" . JText::_('COM_REDSHOP_REMOVE_PRODUCT_FROM_WISHLIST') . "</a></div>";
            $wishlist_data = str_replace('{remove_product_link}', $mainregdellink, $wishlist_data);
            $mainid .= $row->product_id . ",";
            $totattid .= $totalatt . ",";
            $totcount_no_user_field .= $count_no_user_field . ",";
            $temp_template .= $wishlist_data;
        }
        $my = "<form name='frm' method='POST' action=''>";
        $my .= "<input type='hidden' name='product_id' id='product_id' value='" . $mainid . "' >\n\n\t\t\t<input type='hidden' name='totacc_id' id='totacc_id' value='" . $totattid . "' >\n\t\t\t<input type='hidden' name='totcount_no_user_field' id='totcount_no_user_field' value='" . $totcount_no_user_field . "' >\n\t\t\t<input type='button' name='submit' onclick='return productalladdprice();' value='" . JText::_('COM_REDSHOP_ADD_TO_CART') . "'>\n\t\t\t</form>";
        $data = $template_d1[0] . $temp_template . $template_d2[1];
        $data = str_replace('{back_link}', '', $data);
        $data = str_replace('{all_cart}', $my, $data);
        $data = $redTemplate->parseredSHOPplugin($data);
        echo eval("?>" . $data . "<?php ");
    }
}
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的producthelper::getProductAccessory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。