本文整理汇总了PHP中producthelper::getProductAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP producthelper::getProductAttribute方法的具体用法?PHP producthelper::getProductAttribute怎么用?PHP producthelper::getProductAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类producthelper
的用法示例。
在下文中一共展示了producthelper::getProductAttribute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAttributes
/**
* Load the attributes for export
*
* @return void
*/
private function loadAttributes()
{
$producthelper = new producthelper();
$db = JFactory::getDbo();
$query = "SELECT * FROM `#__redshop_product` ORDER BY product_id asc ";
$this->_db->setQuery($query);
$cur = $this->_db->loadObjectList();
$ret = null;
if (count($cur) > 0) {
$redhelper = new redhelper();
$isrecrm = false;
if ($redhelper->isredCRM()) {
$isrecrm = true;
}
for ($i = 0; $i < count($cur); $i++) {
if ($i == 0) {
echo '"product_number","attribute_name","attribute_ordering","allow_multiple_selection","hide_attribute_price","attribute_required","display_type","property_name","property_stock"';
if ($isrecrm) {
echo ',"property_stock_placement"';
}
echo ',"property_ordering","property_virtual_number","setdefault_selected","setdisplay_type","oprand","property_price","property_image","property_main_image","subattribute_color_name","subattribute_stock"';
if ($isrecrm) {
echo ',"subattribute_stock_placement"';
}
echo ',"subattribute_color_ordering","subattribute_setdefault_selected","subattribute_color_title","subattribute_virtual_number","subattribute_color_oprand","required_sub_attribute","subattribute_color_price","subattribute_color_image","delete"';
echo "\r\n";
}
// Added attribute of products
$attribute = $producthelper->getProductAttribute($cur[$i]->product_id);
$attr = array();
for ($att = 0; $att < count($attribute); $att++) {
if ($attribute[$att]->attribute_name != "") {
echo '"' . $cur[$i]->product_number . '","' . $attribute[$att]->attribute_name . '","' . $attribute[$att]->ordering . '","' . $attribute[$att]->allow_multiple_selection . '","' . $attribute[$att]->hide_attribute_price . '","' . $attribute[$att]->attribute_required . '","' . $attribute[$att]->display_type . '"';
if ($isrecrm) {
echo ',,';
}
echo ',,,,,,,,,,,,,,,,"0"';
echo "\r\n";
$att_property = $producthelper->getAttibuteProperty(0, $attribute[$att]->attribute_id);
for ($prop = 0; $prop < count($att_property); $prop++) {
$property_image = "";
$property_main_image = "";
$main_attribute_stock = "";
$sel_arrtibute_stock = "select * from `#__redshop_product_attribute_stockroom_xref` where section_id='" . $att_property[$prop]->property_id . "'";
$this->_db->setQuery($sel_arrtibute_stock);
$fetch_arrtibute_stock = $this->_db->loadObjectList();
for ($h = 0; $h < count($fetch_arrtibute_stock); $h++) {
$main_attribute_stock .= $fetch_arrtibute_stock[$h]->stockroom_id . ":" . $fetch_arrtibute_stock[$h]->quantity . "#";
}
if ($att_property[$prop]->property_image != "") {
$property_image = REDSHOP_FRONT_IMAGES_ABSPATH . 'product_attributes/' . $att_property[$prop]->property_image;
}
if ($att_property[$prop]->property_main_image != "") {
$property_main_image = REDSHOP_FRONT_IMAGES_ABSPATH . 'property/' . $att_property[$prop]->property_main_image;
}
echo '"' . $cur[$i]->product_number . '","' . $attribute[$att]->attribute_name . '",,,,,,"' . $att_property[$prop]->property_name . '","' . $main_attribute_stock . '"';
if ($isrecrm) {
$main_attribute_stock_placement = "";
// Initialiase variables.
$query = $this->_db->getQuery(true);
// Prepare query.
$query->select('stock_placement');
$query->from('#__redcrm_attribute_stock_placement');
$query->where('section = "property"');
$query->where('section_id = "' . $att_property[$prop]->property_id . '"');
// Inject the query and load the result.
$this->_db->setQuery($query);
$main_attribute_stock_placement = $this->_db->loadResult();
echo ',"' . $main_attribute_stock_placement . '"';
}
echo ',"' . $att_property[$prop]->ordering . '","' . $att_property[$prop]->property_number . '","' . $att_property[$prop]->setdefault_selected . '","' . $att_property[$prop]->setdisplay_type . '","' . $att_property[$prop]->oprand . '","' . $att_property[$prop]->property_price . '","' . $property_image . '","' . $property_main_image . '"';
if ($isrecrm) {
echo ',';
}
echo ',,,,,,,,,"0"';
echo "\n";
$subatt_property = $producthelper->getAttibuteSubProperty(0, $att_property[$prop]->property_id);
for ($subprop = 0; $subprop < count($subatt_property); $subprop++) {
$subattribute_color_image = "";
$main_attribute_stock_sub = "";
$sel_arrtibute_stock_sub = "select * from `#__redshop_product_attribute_stockroom_xref` where section_id='" . $subatt_property[$subprop]->subattribute_color_id . "'";
$this->_db->setQuery($sel_arrtibute_stock_sub);
$fetch_arrtibute_stock_sub = $this->_db->loadObjectList();
for ($b = 0; $b < count($fetch_arrtibute_stock_sub); $b++) {
$main_attribute_stock_sub .= $fetch_arrtibute_stock_sub[$b]->stockroom_id . ":" . $fetch_arrtibute_stock_sub[$b]->quantity . "#";
}
if ($subatt_property[$subprop]->subattribute_color_image != "") {
$subattribute_color_image = REDSHOP_FRONT_IMAGES_ABSPATH . 'subcolor/' . $subatt_property[$subprop]->subattribute_color_image;
}
echo '"' . $cur[$i]->product_number . '","' . $attribute[$att]->attribute_name . '",,,,,,"' . $att_property[$prop]->property_name . '"';
if ($isrecrm) {
echo ',';
}
echo ',,,,,,,,,,"' . $subatt_property[$subprop]->subattribute_color_name . '","' . $main_attribute_stock_sub . '"';
if ($isrecrm) {
//.........这里部分代码省略.........
示例2: replaceSubPropertyData
public function replaceSubPropertyData($product_id = 0, $accessory_id = 0, $attribute_id = 0, $property_id = 0, $user_id, $uniqueid = "")
{
$producthelper = new producthelper();
$subproperty = array();
if ($property_id != 0 && $attribute_id != 0) {
$attributes = $producthelper->getProductAttribute(0, 0, $attribute_id);
$attributes = $attributes[0];
$subproperty = $producthelper->getAttibuteSubProperty(0, $property_id);
}
if ($accessory_id != 0) {
$prefix = $uniqueid . "acc_";
} else {
$prefix = $uniqueid . "prd_";
}
$attributelist = "";
if (count($subproperty) > 0) {
$commonid = $prefix . $product_id . '_' . $accessory_id . '_' . $attribute_id . '_' . $property_id;
$subpropertyid = 'subproperty_id_' . $commonid;
for ($i = 0; $i < count($subproperty); $i++) {
$attributes_subproperty_vat = 0;
if ($subproperty[$i]->subattribute_color_price > 0) {
$attributes_subproperty_vat = $producthelper->getProducttax($product_id, $subproperty[$i]->subattribute_color_price);
$subproperty[$i]->subattribute_color_price += $attributes_subproperty_vat;
$subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name) . " (" . $subproperty[$i]->oprand . $producthelper->getProductFormattedPrice($subproperty[$i]->subattribute_color_price) . ")";
} else {
$subproperty[$i]->text = urldecode($subproperty[$i]->subattribute_color_name);
}
$attributelist .= '<input type="hidden" id="' . $subpropertyid . '_oprand' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->oprand . '" />';
$attributelist .= '<input type="hidden" id="' . $subpropertyid . '_protax' . $subproperty[$i]->value . '" value="' . $attributes_subproperty_vat . '" />';
$attributelist .= '<input type="hidden" id="' . $subpropertyid . '_proprice' . $subproperty[$i]->value . '" value="' . $subproperty[$i]->subattribute_color_price . '" />';
}
$tmp_array = array();
$tmp_array[0]->value = 0;
$tmp_array[0]->text = JText::_('COM_REDSHOP_SELECT') . " " . urldecode($subproperty[0]->property_name);
$new_subproperty = array_merge($tmp_array, $subproperty);
$chklist = "";
if ($attributes->allow_multiple_selection) {
for ($chk = 0; $chk < count($subproperty); $chk++) {
$chklist .= "<br /><input type='checkbox' value='" . $subproperty[$chk]->value . "' name='" . $subpropertyid . "[]' id='" . $subpropertyid . "' class='inputbox' onchange='javascript:calculateOfflineTotalPrice(\"" . $uniqueid . "\");' /> " . $subproperty[$chk]->text;
}
} else {
$chklist = JHTML::_('select.genericlist', $new_subproperty, $subpropertyid . '[]', ' id="' . $subpropertyid . '" class="inputbox" size="1" onchange="javascript:calculateOfflineTotalPrice(\'' . $uniqueid . '\');" ', 'value', 'text', '');
}
$lists['subproperty_id'] = $chklist;
$attributelist .= "<tr><td>" . urldecode($subproperty[0]->property_name) . " : " . $lists['subproperty_id'];
}
return $attributelist;
}
示例3: onRSProductSearch
//.........这里部分代码省略.........
}
}
}
$data_add = $data_add . $hidden_userfield;
/*************** end user fields ***************/
// ProductFinderDatepicker Extra Field Start
$fieldArray = $extraField->getSectionFieldList(17, 0, 0);
$data_add = $producthelper->getProductFinderDatepickerValue($data_add, $this->search[$i]->product_id, $fieldArray);
// ProductFinderDatepicker Extra Field End
/*
* manufacturer data
*/
$manufacturer_id = $this->search[$i]->manufacturer_id;
if ($manufacturer_id != 0) {
$manufacturer_data = $producthelper->getSection("manufacturer", $manufacturer_id);
$manufacturer_link_href = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer_id . '&Itemid=' . $Itemid);
$manufacturer_name = "";
if (count($manufacturer_data) > 0) {
$manufacturer_name = $manufacturer_data->manufacturer_name;
}
$manufacturer_link = '<a href="' . $manufacturer_link_href . '" title="' . $manufacturer_name . '">' . $manufacturer_name . '</a>';
if (strstr($data_add, "{manufacturer_link}")) {
$data_add = str_replace("{manufacturer_name}", "", $data_add);
} else {
$data_add = str_replace("{manufacturer_name}", $manufacturer_name, $data_add);
}
$data_add = str_replace("{manufacturer_link}", $manufacturer_link, $data_add);
} else {
$data_add = str_replace("{manufacturer_link}", "", $data_add);
$data_add = str_replace("{manufacturer_name}", "", $data_add);
}
// End
// Replace wishlistbutton
$data_add = $producthelper->replaceWishlistButton($this->search[$i]->product_id, $data_add);
// Replace compare product button
$data_add = $producthelper->replaceCompareProductsButton($this->search[$i]->product_id, 0, $data_add);
// Checking for child products
$childproduct = $producthelper->getChildProduct($this->search[$i]->product_id);
if (count($childproduct) > 0) {
$isChilds = true;
$attributes = array();
} else {
$isChilds = false;
// Get attributes
$attributes_set = array();
if ($this->search[$i]->attribute_set_id > 0) {
$attributes_set = $producthelper->getProductAttribute(0, $this->search[$i]->attribute_set_id, 0, 1);
}
$attributes = $producthelper->getProductAttribute($this->search[$i]->product_id);
$attributes = array_merge($attributes, $attributes_set);
}
// Product attribute Start
$totalatt = count($attributes);
// Check product for not for sale
$data_add = $producthelper->getProductNotForSaleComment($this->search[$i], $data_add, $attributes);
$data_add = $producthelper->replaceProductInStock($this->search[$i]->product_id, $data_add, $attributes, $attribute_template);
$data_add = $producthelper->replaceAttributeData($this->search[$i]->product_id, 0, 0, $attributes, $data_add, $attribute_template, $isChilds);
// Cart Template
$data_add = $producthelper->replaceCartTemplate($this->search[$i]->product_id, 0, 0, 0, $data_add, $isChilds, $userfieldArr, $totalatt, 0, $count_no_user_field, "");
$data .= $data_add;
}
$app = JFactory::getApplication();
$router = $app->getRouter();
$getorderby = JRequest::getVar('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
$vars = array('option' => 'com_redshop', 'view' => 'search', 'layout' => $layout, 'keyword' => $keyword, 'manufacture_id' => $manufacture_id, 'order_by' => $getorderby, 'category_id' => $cid, 'Itemid' => $Itemid, 'limit' => $limit);
$router->setVars($vars);
unset($vars);
if (strstr($template_org, "{pagination}")) {
$pagination = new redPagination($total_product, $start, $endlimit);
$slidertag = $pagination->getPagesLinks();
if (strstr($template_org, "{product_display_limit}")) {
$slidertag = "<form action='' method='post'><input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'> " . $pagination->getListFooter() . "</form>";
$template_org = str_replace("{product_display_limit}", $slidertag, $template_org);
$template_org = str_replace("{pagination}", '', $template_org);
}
$template_org = str_replace("{pagination}", $slidertag, $template_org);
}
$template_org = str_replace("{product_display_limit}", "", $template_org);
if (strstr($template_org, "perpagelimit:")) {
$perpage = explode('{perpagelimit:', $template_org);
$perpage = explode('}', $perpage[1]);
$template_org = str_replace("{perpagelimit:" . intval($perpage[0]) . "}", "", $template_org);
}
$template_org = str_replace("{order_by}", $orderby_form, $template_org);
$template_org = str_replace("{order_by_lbl}", JText::_('COM_REDSHOP_SELECT_ORDER_BY'), $template_org);
$template_org = str_replace("{filter_by_lbl}", JText::_('COM_REDSHOP_SELECT_FILTER_BY'), $template_org);
$template_org = str_replace("{attribute_price_with_vat}", "", $template_org);
$template_org = str_replace("{attribute_price_without_vat}", "", $template_org);
$template_org = str_replace("{product_loop_start}", "", $template_org);
$template_org = str_replace("{product_loop_end}", "", $template_org);
$template_org = str_replace($template_tmp_desc, $data, $template_org);
$template_org = str_replace("{with_vat}", "", $template_org);
$template_org = str_replace("{without_vat}", "", $template_org);
$template_org = $redTemplate->parseredSHOPplugin($template_org);
$template_org = $texts->replace_texts($template_org);
eval("?>" . $template_org . "<?php ");
} else {
echo "<br><h3>" . JText::_('COM_REDSHOP_MSG_SORRY_NO_RESULT_FOUND') . "</h3>";
}
}
示例4: 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;
}
示例5: producthelper
$slide_params = json_decode($slide->params);
$product_item = modRedSliderHelper::getProductItem($slide_params);
$product_image = $slide_params->product_image;
if ($product_item->product_full_image) {
$product_image = JURI::base(true) . '/components/com_redshop/assets/images/product/' . $product_item->product_full_image;
}
$product_template = $slide->template_description;
$product_template = str_replace("{product_image}", '<img src="' . $product_image . '">', $product_template);
$product_template = str_replace("{product_name}", $product_item->product_name, $product_template);
$product_template = str_replace("{product_description}", $product_item->product_s_desc, $product_template);
$product_template = str_replace("{product_price}", $product_item->product_price, $product_template);
$product_template = str_replace("{product_quantity}", "<input class=\"product-quantity\" type=\"number\" value=\"1\" style=\"width:30px\">", $product_template);
$product_template = str_replace("{addtocart_button}", "<input class=\"addtocart-button\" type=\"submit\" value=\"Add to cart\" style=\"width:100px\">", $product_template);
require_once JPATH_SITE . '/components/com_redshop/helpers/helper.php';
$product_helper = new producthelper();
$attribute_list = $product_helper->getProductAttribute($product_item->product_id);
$product_attribute_html = "";
foreach ($attribute_list as $attribute) {
$attribute_properties = $product_helper->getAttibuteProperty(0, $attribute->attribute_id);
$select_row = new stdClass();
$select_row->value = "0";
$select_row->text = "Select " . $attribute->text;
$attribute_properties = array_merge(array(0 => $select_row), $attribute_properties);
$product_attribute_html .= "<div>" . JHtml::_('select.genericlist', $attribute_properties, '', 'class="product-attribute" name="product-attribute" style="width:100px"') . "</div>";
}
$product_template = str_replace("{product_attribute}", $product_attribute_html, $product_template);
?>
<li>
<div class="content">
<img src="<?php
示例6: array
// Replace compare product button.
$prddata_add = $producthelper->replaceCompareProductsButton($product->product_id, $this->catid, $prddata_add);
if (strstr($prddata_add, "{stockroom_detail}")) {
$prddata_add = $stockroomhelper->replaceStockroomAmountDetail($prddata_add, $product->product_id);
}
// Checking for child products.
$childproduct = $producthelper->getChildProduct($product->product_id);
if (count($childproduct) > 0) {
$isChilds = true;
$attributes = array();
} else {
$isChilds = false;
// Get attributes.
$attributes_set = array();
if ($product->attribute_set_id > 0) {
$attributes_set = $producthelper->getProductAttribute(0, $product->attribute_set_id, 0, 1);
}
$attributes = $producthelper->getProductAttribute($product->product_id);
$attributes = array_merge($attributes, $attributes_set);
}
// Product attribute - Start.
$totalatt = count($attributes);
// Check product for not for sale.
$prddata_add = $producthelper->getProductNotForSaleComment($product, $prddata_add, $attributes);
$prddata_add = $producthelper->replaceProductInStock($product->product_id, $prddata_add, $attributes, $attribute_template);
$prddata_add = $producthelper->replaceAttributeData($product->product_id, 0, 0, $attributes, $prddata_add, $attribute_template, $isChilds);
// Get cart tempalte.
$prddata_add = $producthelper->replaceCartTemplate($product->product_id, $this->catid, 0, 0, $prddata_add, $isChilds, $userfieldArr, $totalatt, $totacc, $count_no_user_field);
}
$data_add = str_replace("{product_loop_start}", "", $data_add);
$data_add = str_replace("{product_loop_end}", "", $data_add);
示例7: getTotalProperty
public function getTotalProperty($productId)
{
$producthelper = new producthelper();
// Collect Attributes
$attribute = $producthelper->getProductAttribute($productId);
$attributeId = $attribute[0]->value;
// Collect Property
$property = $producthelper->getAttibuteProperty(0, $attributeId, $productId);
return count($property);
}
示例8: gbasefeed
public function gbasefeed($data)
{
$producthelper = new producthelper();
$stockroomhelper = new rsstockroomhelper();
$shippinghelper = new shipping();
$unpublished_data = $data['unpublished_data'];
$cid = $data['cid'];
$url = JURI::root();
$currency = new CurrencyHelper();
$product_img_url = $url . 'components/com_redshop/assets/images/product/';
$file_path = JPATH_COMPONENT_SITE . "/assets/document/gbase";
$file_name = $file_path . "/product.xml";
if (count($cid)) {
$cids = implode(',', $cid);
if ($unpublished_data == 1) {
$query = "SELECT p.*,m.manufacturer_name FROM " . $this->_table_prefix . "product AS p " . " LEFT JOIN " . $this->_table_prefix . "manufacturer AS m" . " ON p.manufacturer_id = m.manufacturer_id" . " WHERE p.product_id IN (" . $cids . ")";
} else {
$query = "SELECT p.*,m.manufacturer_name FROM " . $this->_table_prefix . "product AS p " . " LEFT JOIN " . $this->_table_prefix . "manufacturer AS m" . " ON p.manufacturer_id = m.manufacturer_id" . " WHERE p.product_id IN (" . $cids . ") and p.published =1";
}
$this->_db->setQuery($query);
$rs = $this->_db->loadObjectlist();
// For shipping information
$shippingArr = $shippinghelper->getShopperGroupDefaultShipping();
$default_shipping = 0.0;
$shipping_rate = $currency->convert(number_format($shippingArr['shipping_rate'], PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
$default_shipping = count($shippingArr) > 0 ? $shipping_rate : number_format($default_shipping, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR);
$default_shipping_country = DEFAULT_SHIPPING_COUNTRY;
$xml_code = '<?xml version="1.0" encoding="UTF-8" ';
$xml_code .= '<rss version ="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">';
$xml_code .= "<channel>";
for ($i = 0; $i < count($rs); $i++) {
// For additional images
$additional_images = $producthelper->getAdditionMediaImage($rs[$i]->product_id, $section = "product", $mediaType = "images");
$add_image = "";
for ($ad = 0; $ad < 10; $ad++) {
if (trim($additional_images[$ad]->product_full_image) != trim($additional_images[$ad]->media_name) && trim($additional_images[$ad]->media_name) != "") {
$add_image .= "<g:additional_image_link>" . $product_img_url . htmlspecialchars($additional_images[$ad]->media_name, ENT_NOQUOTES, "UTF-8") . "</g:additional_image_link>";
}
}
// For getting product Category
$category_name = $producthelper->getCategoryNameByProductId($rs[$i]->product_id);
if (USE_STOCKROOM == 1) {
// For cunt attributes
$attributes_set = array();
if ($rs[$i]->attribute_set_id > 0) {
$attributes_set = $producthelper->getProductAttribute(0, $rs[$i]->attribute_set_id, 0, 1);
}
$attributes = $producthelper->getProductAttribute($rs[$i]->product_id);
$attributes = array_merge($attributes, $attributes_set);
$totalatt = count($attributes);
// Get stock details
$isStockExists = $stockroomhelper->isStockExists($rs[$i]->product_id);
if ($totalatt > 0 && !$isStockExists) {
$isStockExists = $stockroomhelper->isAttributeStockExists($product_id);
}
$isPreorderStockExists = $stockroomhelper->isPreorderStockExists($product_id);
if ($totalatt > 0 && !$isPreorderStockExists) {
$isPreorderStockExists = $stockroomhelper->isAttributePreorderStockExists($product_id);
}
if (!$isStockExists) {
$product_preorder = $rs[$i]->preorder;
if ($product_preorder == "global" && ALLOW_PRE_ORDER || $product_preorder == "yes" || $product_preorder == "" && ALLOW_PRE_ORDER) {
if (!$isPreorderStockExists) {
$product_status = JText::_('COM_REDSHOP_OUT_OF_STOCK');
} else {
$product_status = JText::_('COM_REDSHOP_PREORDER');
}
} else {
$product_status = JText::_('COM_REDSHOP_OUT_OF_STOCK');
}
} else {
$product_status = JText::_('COM_REDSHOP_AVAILABLE_FOR_ORDER');
}
} else {
$product_status = JText::_('COM_REDSHOP_AVAILABLE_FOR_ORDER');
}
$product_on_sale = 0;
if ($rs[$i]->product_on_sale == 1 && ($rs[$i]->discount_stratdate == 0 && $rs[$i]->discount_enddate == 0 || $rs[$i]->discount_stratdate <= time() && $rs[$i]->discount_enddate >= time())) {
$product_on_sale = 1;
}
// For price and vat settings
$product_price = $rs[$i]->product_price;
$discount_price = $rs[$i]->discount_price;
$sale_price = $product_on_sale == 1 ? $discount_price : $product_price;
$price_vat = $producthelper->getGoogleVatRates($rs[$i]->product_id, $product_price, USE_TAX_EXEMPT);
$sale_price_vat = $producthelper->getGoogleVatRates($rs[$i]->product_id, $sale_price, USE_TAX_EXEMPT);
if (DEFAULT_VAT_COUNTRY != "USA") {
$product_price = $rs[$i]->product_price + $price_vat;
$sale_price = $sale_price + $sale_price_vat;
}
$product_price = $currency->convert(number_format($product_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
$discount_price = $currency->convert(number_format($discount_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
$sale_price = $currency->convert(number_format($sale_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
$price_vat = $currency->convert(number_format($price_vat, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
$product_url = $url . "index.php?option=com_redshop&view=product&pid=" . $rs[$i]->product_id;
$xml_code .= "\n<item>";
$xml_code .= "\n<g:id>" . htmlspecialchars($rs[$i]->product_id, ENT_NOQUOTES, "UTF-8") . "</g:id>";
$xml_code .= "\n<title>" . htmlspecialchars($rs[$i]->product_name, ENT_NOQUOTES, "UTF-8") . "</title>";
$xml_code .= "\n<description>'" . htmlspecialchars($rs[$i]->product_s_desc, ENT_NOQUOTES, "UTF-8") . "'</description>";
$xml_code .= "\n<g:product_type>'" . htmlspecialchars($category_name, ENT_NOQUOTES, "UTF-8") . "'</g:product_type>";
//.........这里部分代码省略.........
示例9: delete_attibute
/**
* Function delete_attibute.
*
* @param int $product_id attribute_id
* @param int $attribute_id property_id
* @param int $attribute_set_id attribute_set_id
*
* @return void
*/
public function delete_attibute($product_id, $attribute_id, $attribute_set_id)
{
$producthelper = new producthelper();
if (empty($attribute_set_id) && empty($product_id)) {
exit;
}
if ($attribute_id) {
$attributes = array();
$attributes[0] = new stdClass();
$attributes[0]->attribute_id = $attribute_id;
} else {
if ($product_id) {
$attributes = $producthelper->getProductAttribute($product_id);
} else {
$attributes = $producthelper->getProductAttribute(0, $attribute_set_id);
}
}
if ($product_id) {
$and = "`product_id`='" . $product_id . "'";
} else {
$and = "`attribute_set_id`='" . $attribute_set_id . "'";
}
for ($i = 0; $i < count($attributes); $i++) {
$query = "DELETE FROM `" . $this->table_prefix . "product_attribute`\r\n\t\t\t\t\t WHERE " . $and . " and `attribute_id` = '" . $attributes[$i]->attribute_id . "' ";
$this->_db->setQuery($query);
if ($this->_db->query()) {
$this->delete_prop($attributes[$i]->attribute_id, 0);
}
}
exit;
}
示例10: eval
$related_template_data = str_replace("{relproduct_price_saving_lbl}", '', $related_template_data);
$related_template_data = str_replace("{relproduct_price_saving}", '', $related_template_data);
$related_template_data = str_replace("{relproduct_price}", '', $related_template_data);
}
// End Show Price
$relmorelinkhref = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&cid=' . $related_product[$r]->cat_in_sefurl . '&Itemid=' . $this->itemId);
$relmorelink = 'javascript:window.parent.SqueezeBox.close();window.parent.location.href="' . $relmorelinkhref . '"';
$rmore = "<a href='" . $relmorelink . "' title='" . $related_product[$r]->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
$related_template_data = str_replace("{read_more}", $rmore, $related_template_data);
$related_template_data = str_replace("{read_more_link}", $relmorelink, $related_template_data);
/*
* related product Required Attribute start
* this will parse only Required Attributes
*/
$relid = $related_product[$r]->product_id;
$attributes_set = array();
if ($related_product[$r]->attribute_set_id > 0) {
$attributes_set = $producthelper->getProductAttribute(0, $related_product[$r]->attribute_set_id);
}
$attributes = $producthelper->getProductAttribute($relid);
$attributes = array_merge($attributes, $attributes_set);
$related_template_data = $producthelper->replaceAttributeData($related_product[$r]->mainproduct_id, 0, $related_product[$r]->product_id, $attributes, $related_template_data, $attribute_template);
$related_template_data = $producthelper->replaceCartTemplate($related_product[$r]->mainproduct_id, $this->data->category_id, 0, $related_product[$r]->product_id, $related_template_data, false, 0, count($attributes), 0, 0);
$related_template_data = $producthelper->replaceCompareProductsButton($related_product[$r]->product_id, $this->data->category_id, $related_template_data, 1);
$related_template_data = $producthelper->replaceProductInStock($related_product[$r]->product_id, $related_template_data);
$related_template_data = $producthelper->replaceAttributePriceList($related_product[$r]->product_id, $related_template_data);
$related_template_data = $producthelper->getProductFinderDatepickerValue($related_template_data, $related_product[$r]->product_id, $fieldArray);
}
$reltemplate = $tempdata_div_start . $related_template_data . $tempdata_div_end;
}
echo eval("?>" . $reltemplate . "<?php ");
示例11: attribute_empty
public function attribute_empty()
{
$database = JFactory::getDbo();
$producthelper = new producthelper();
if ($this->_id) {
$attributes = $producthelper->getProductAttribute(0, $this->_id);
for ($i = 0; $i < count($attributes); $i++) {
$query = "DELETE FROM `" . $this->_table_prefix . "product_attribute` WHERE `attribute_id` = " . $attributes[$i]->attribute_id;
$database->setQuery($query);
if ($database->query()) {
$property = $producthelper->getAttibuteProperty(0, $attributes[$i]->attribute_id);
for ($j = 0; $j < count($property); $j++) {
$query = "DELETE FROM `" . $this->_table_prefix . "product_attribute_property` WHERE `property_id` = " . $property[$j]->property_id;
$database->setQuery($query);
if ($database->query()) {
$query = "DELETE FROM `" . $this->_table_prefix . "product_subattribute_color` WHERE `subattribute_id` = " . $property[$j]->property_id;
$database->setQuery($query);
$database->query();
}
}
}
}
}
return true;
}
示例12: display_products
//.........这里部分代码省略.........
$parentid = 0;
for ($c = 0; $c < count($childproducts); $c++) {
if ($childproducts[$c]->product_parent_id == 0) {
$level = "";
} else {
if ($parentid != $childproducts[$c]->product_parent_id) {
$level = $level;
}
}
$parentid = $childproducts[$c]->product_parent_id;
$childproducts[$c]->product_name = $level . $childproducts[$c]->product_name;
}
$cld_name = @array_merge($cld_name, $childproducts);
}
$selected = array($row->product_id);
$lists['product_child_id'] = JHTML::_('select.genericlist', $cld_name, 'pid', 'class="inputbox" size="1" onchange="document.frmChild.submit();"', 'product_id', 'product_name', $selected);
$frmChild .= "<form name='frmChild' method='get'>";
$frmChild .= JText::_('COM_REDSHOP_CHILD_PRODUCTS') . $lists['product_child_id'];
$frmChild .= "<input type='hidden' name='Itemid' value='" . $Itemid . "'>";
$frmChild .= "<input type='hidden' name='cid' value='" . $row->category_id . "'>";
$frmChild .= "<input type='hidden' name='view' value='product'>";
$frmChild .= "<input type='hidden' name='option' value='com_redshop'>";
$frmChild .= "</form>";
}
}
$wishlist_data = str_replace("{child_products}", $frmChild, $wishlist_data);
}
$childproduct = $producthelper->getChildProduct($row->product_id);
if (count($childproduct) > 0) {
if (PURCHASE_PARENT_WITH_CHILD == 1) {
$isChilds = false;
$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, $wishlist_data);
} else {
$isChilds = true;
$attributes = array();
}
} else {
$isChilds = false;
$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);
}
$attribute_template = $producthelper->getAttributeTemplate($wishlist_data);
// Check product for not for sale
$wishlist_data = $producthelper->getProductNotForSaleComment($row, $wishlist_data, $attributes);
$wishlist_data = $producthelper->replaceProductInStock($row->product_id, $wishlist_data, $attributes, $attribute_template);
/////////////////////////////////// Product attribute Start /////////////////////////////////
$totalatt = count($attributes);
$wishlist_data = $producthelper->replaceAttributeData($row->product_id, 0, 0, $attributes, $wishlist_data, $attribute_template, $isChilds);
/////////////////////////////////// Product attribute End // Checking for child products end/////////////////////////////////
if (!$row->not_for_sale) {
if ($row->product_on_sale && $product_price_discount > 0) {
if ($product_price > $product_price_discount) {
$s_price = $product_price - $product_price_discount;
if ($this->show_discountpricelayout) {
$mainproduct_price = $producthelper->getProductFormattedPrice($product_price);
$product_price = $product_price_discount;
$mainproduct_price = $producthelper->getProductFormattedPrice($product_price_discount);
示例13: getPreorderStockAmountwithReserve
function getPreorderStockAmountwithReserve($section_id = 0, $section = "product", $stockroom_id = 0)
{
$quantity = 1;
if (USE_STOCKROOM == 1) {
$and = "";
$table = "product";
$db = JFactory::getDbo();
if ($section != "product") {
$table = "product_attribute";
}
if ($section_id != 0) {
// Sanitize ids
$section_id = explode(',', $section_id);
JArrayHelper::toInteger($section_id);
if ($section != "product") {
$and = "AND x.section = " . $db->quote($section) . " AND x.section_id IN (" . implode(',', $section_id) . ") ";
} else {
$and = "AND x.product_id IN (" . implode(',', $section_id) . ") ";
}
}
if ($stockroom_id != 0) {
$and .= "AND x.stockroom_id = " . (int) $stockroom_id . " ";
}
$query = "SELECT SUM(x.preorder_stock) as preorder_stock, SUM(x.ordered_preorder) as ordered_preorder FROM " . $this->_table_prefix . $table . "_stockroom_xref AS x " . ", " . $this->_table_prefix . "stockroom AS s " . "WHERE s.stockroom_id=x.stockroom_id " . "AND x.quantity>=0 " . $and . "ORDER BY s.min_del_time ";
$db->setQuery($query);
$pre_order_stock = $db->loadObjectList();
if ($pre_order_stock[0]->ordered_preorder == $pre_order_stock[0]->preorder_stock || $pre_order_stock[0]->ordered_preorder > $pre_order_stock[0]->preorder_stock) {
$quantity = 0;
} else {
$quantity = $pre_order_stock[0]->preorder_stock - $pre_order_stock[0]->ordered_preorder;
}
} else {
$helper = new redhelper();
if ($helper->isredCRM()) {
if (ENABLE_ITEM_TRACKING_SYSTEM && !ENABLE_ONE_STOCKROOM_MANAGEMENT) {
// Include redSHOP product helper
$producthelper = new producthelper();
// Supplier order helper object
$crmSupplierOrderHelper = new crmSupplierOrderHelper();
$getstockdata = new stdClass();
$getstockdata->property_id = 0;
$getstockdata->subproperty_id = 0;
if ($section == "product") {
$getstockdata->product_id = $section_id;
} elseif ($section == "property") {
$property = $producthelper->getAttibuteProperty($section_id);
$attribute_id = $property[0]->attribute_id;
$attribute = $producthelper->getProductAttribute(0, 0, $attribute_id);
$product_id = $attribute[0]->product_id;
$getstockdata->product_id = $product_id;
$getstockdata->property_id = $section_id;
} elseif ($section == "subproperty") {
$subproperty = $producthelper->getAttibuteSubProperty($section_id);
$property_id = $subproperty[0]->subattribute_id;
$property = $producthelper->getAttibuteProperty($property_id);
$attribute_id = $property[0]->attribute_id;
$attribute = $producthelper->getProductAttribute(0, 0, $attribute_id);
$product_id = $attribute[0]->product_id;
$getstockdata->product_id = $product_id;
$getstockdata->property_id = $property_id;
$getstockdata->subproperty_id = $section_id;
}
$quantity = $crmSupplierOrderHelper->getSupplierStock($getstockdata);
}
}
}
return $quantity;
}