/**
 +----------------------------------------------------------
 * 获取商品单价
 *
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param string $agencyid 机构id
 * @param string $sdcrid 商家id
 	 * @param string $produreid 商品id
 	 * @param string $producetype 商品类型id
 	 * @param string $storageid 商品仓库id
 	 * @param string $pricetype 价格类型 (0=本位价格,20=令价,21=吨价)
 +----------------------------------------------------------
 * @return string 
 +----------------------------------------------------------
 */
 function getsdcrprice($agencyid, $sdcrid, $produreid, $producetype, $storageid, $pricetype = 0)
 {
     global $g_lprice_point;
     global $g_dprice_point;
     $db = new DB_test();
     $query = "select fd_nbsepe_sdcrid,fd_nbsepe_produreid,fd_produre_catalog,fd_nbsepe_lingprice,fd_nbsepe_dunprice,fd_produre_unit\n\t\t\t  from tb_websaleprice left join tb_produre on fd_produre_id = fd_nbsepe_produreid\n\t\t\t  where  fd_nbsepe_iskc = '1'  and   fd_nbsepe_sdcrid = '" . $sdcrid . "'\n\t\t\t  and fd_nbsepe_produreid  = '" . $produreid . "' and fd_nbsepe_producetype  = '" . $producetype . "' \n\t\t\t  and fd_nbsepe_isshow='1'";
     // echo $query;
     $db->query($query);
     if ($db->nf()) {
         while ($db->next_record()) {
             $areaid = $db->f(fd_nbsepe_sdcrid);
             $produreid = $db->f(fd_nbsepe_produreid);
             $boxprocaid = $db->f(fd_produre_catalog);
             $unitid = $db->f(fd_produre_unit);
             if ($unitid == 20) {
                 $returnvalue = round($db->f(fd_nbsepe_lingprice) * 1.04, 3);
             }
             if ($unitid == 21) {
                 $returnvalue = round($db->f(fd_nbsepe_dunprice) * 1.04, 0);
             }
             if ($pricetype == 20) {
                 $returnvalue = round($db->f(fd_nbsepe_lingprice) * 1.04, 3);
             }
             if ($pricetype == 21) {
                 $returnvalue = round($db->f(fd_nbsepe_dunprice) * 1.04, 0);
             }
         }
     }
     $dbshop = new DB_shop();
     $query = "select fd_skqy_lingprice ,fd_skqy_dunprice,fd_skqy_unitid,\n\t\t\tfd_skqy_shopid,fd_skqy_commid  ,fd_skqy_rate \n\t\t\tfrom tb_shopkcquantity where fd_skqy_shopid = '{$sdcrid}' and fd_skqy_commid= '{$produreid}'\n\t\t\tand fd_skqy_producetype = '{$producetype}' and fd_skqy_storageid= '{$storageid}'\n\t\t\t";
     $dbshop->query($query);
     if ($dbshop->nf()) {
         while ($dbshop->next_record()) {
             $unitid = $dbshop->f(fd_skqy_unitid);
             $vlingprice = $dbshop->f(fd_skqy_lingprice);
             $vdunprice = $dbshop->f(fd_skqy_dunprice);
             $rate = $dbshop->f(fd_skqy_rate);
             if ($unitid == 20) {
                 $returnvalue = formatprice($vlingprice * $rate, $g_lprice_point);
             }
             if ($unitid == 21) {
                 $returnvalue = formatprice($vdunprice * $rate, $g_dprice_point);
             }
             if ($pricetype == 20) {
                 $returnvalue = formatprice($vlingprice * $rate, $g_lprice_point);
             }
             if ($pricetype == 21) {
                 $returnvalue = formatprice($vdunprice * $rate, $g_dprice_point);
             }
         }
     }
     return $returnvalue + 0;
 }
 /**
  * get attributes html selects, price for select attribute 
  */
 function ajax_attrib_select_and_price()
 {
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     $product_id = JRequest::getInt('product_id');
     $change_attr = JRequest::getInt('change_attr');
     if ($jshopConfig->use_decimal_qty) {
         $qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
     } else {
         $qty = JRequest::getInt('qty', 1);
     }
     if ($qty < 0) {
         $qty = 0;
     }
     $attribs = JRequest::getVar('attr');
     if (!is_array($attribs)) {
         $attribs = array();
     }
     $freeattr = JRequest::getVar('freeattr');
     if (!is_array($freeattr)) {
         $freeattr = array();
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
     $product = JSFactory::getTable('product', 'jshop');
     $product->load($product_id);
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
     $attributesDatas = $product->getAttributesDatas($attribs);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $product->setFreeAttributeActive($freeattr);
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
     $rows = array();
     foreach ($attributes as $k => $v) {
         $rows[] = '"id_' . $k . '":"' . json_value_encode($v->selects, 1) . '"';
     }
     $pricefloat = $product->getPrice($qty, 1, 1, 1);
     $price = formatprice($pricefloat);
     $available = intval($product->getQty() > 0);
     $displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
     $ean = $product->getEan();
     $weight = formatweight($product->getWeight());
     $basicprice = formatprice($product->getBasicPrice());
     $min_kolichestvo = $product->min_kolichestvo;
     $rows[] = '"price":"' . json_value_encode($price) . '"';
     $rows[] = '"pricefloat":"' . $pricefloat . '"';
     $rows[] = '"available":"' . $available . '"';
     $rows[] = '"min_kolichestvo":"' . $min_kolichestvo . '"';
     $rows[] = '"ean":"' . json_value_encode($ean) . '"';
     if ($jshopConfig->admin_show_product_basic_price) {
         $rows[] = '"basicprice":"' . json_value_encode($basicprice) . '"';
     }
     if ($jshopConfig->product_show_weight) {
         $rows[] = '"weight":"' . json_value_encode($weight) . '"';
     }
     if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
         $rows[] = '"pricedefault":"' . json_value_encode(formatprice($product->product_price_default)) . '"';
     }
     if ($jshopConfig->product_show_qty_stock) {
         $qty_in_stock = getDataProductQtyInStock($product);
         $rows[] = '"qty":"' . json_value_encode(sprintQtyInStock($qty_in_stock)) . '"';
     }
     $product->updateOtherPricesIncludeAllFactors();
     if (is_array($product->product_add_prices)) {
         foreach ($product->product_add_prices as $k => $v) {
             $rows[] = '"pq_' . $v->product_quantity_start . '":"' . json_value_encode(formatprice($v->price)) . '"';
         }
     }
     if ($product->product_old_price) {
         $old_price = formatprice($product->product_old_price);
         $rows[] = '"oldprice":"' . json_value_encode($old_price) . '"';
     }
     $rows[] = '"displaybuttons":"' . $displaybuttons . '"';
     if ($jshopConfig->hide_delivery_time_out_of_stock) {
         $rows[] = '"showdeliverytime":"' . $product->getDeliveryTimeId() . '"';
     }
     if ($jshopConfig->use_extend_attribute_data) {
         $template_path = $jshopConfig->template_path . $jshopConfig->template . "/product";
         $images = $product->getImages();
         $videos = $product->getVideos();
         $demofiles = $product->getDemoFiles();
         $tmp = array();
         foreach ($images as $img) {
             $tmp[] = '"' . $img->image_name . '"';
         }
         if (!file_exists($template_path . "/block_image_thumb.php")) {
             $displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
             $rows[] = '"images":[' . implode(",", $tmp) . '],"displayimgthumb":"' . $displayimgthumb . '"';
         }
         $view_name = "product";
         $view_config = array("template_path" => $template_path);
         $view = $this->getView($view_name, getDocumentType(), '', $view_config);
         $view->setLayout("demofiles");
         $view->assign('config', $jshopConfig);
         $view->assign('demofiles', $demofiles);
         $demofiles = $view->loadTemplate();
         $rows[] = '"demofiles":"' . json_value_encode($demofiles, 1) . '"';
         if (file_exists($template_path . "/block_image_thumb.php")) {
             $product->getDescription();
             $view_name = "product";
             $view_config = array("template_path" => $template_path);
             $view = $this->getView($view_name, getDocumentType(), '', $view_config);
             $view->setLayout("block_image_thumb");
             $view->assign('config', $jshopConfig);
             $view->assign('images', $images);
             $view->assign('videos', $videos);
             $view->assign('image_product_path', $jshopConfig->image_product_live_path);
             $dispatcher->trigger('onBeforeDisplayProductViewBlockImageThumb', array(&$view));
             $block_image_thumb = $view->loadTemplate();
             $view_name = "product";
             $view_config = array("template_path" => $template_path);
             $view = $this->getView($view_name, getDocumentType(), '', $view_config);
             $view->setLayout("block_image_middle");
             $view->assign('config', $jshopConfig);
             $view->assign('images', $images);
             $view->assign('videos', $videos);
             $view->assign('product', $product);
             $view->assign('noimage', $jshopConfig->noimage);
             $view->assign('image_product_path', $jshopConfig->image_product_live_path);
             $view->assign('path_to_image', $jshopConfig->live_path . 'images/');
             $dispatcher->trigger('onBeforeDisplayProductViewBlockImageMiddle', array(&$view));
             $block_image_middle = $view->loadTemplate();
             $rows[] = '"block_image_thumb":"' . json_value_encode($block_image_thumb, 1) . '"';
             $rows[] = '"block_image_middle":"' . json_value_encode($block_image_middle, 1) . '"';
         }
     }
     $dispatcher->trigger('onBeforeDisplayAjaxAttrib', array(&$rows, &$product));
     print '{' . implode(",", $rows) . '}';
     die;
 }
print _JSHOP_EAN;
?>
: <span id="product_code"><?php 
print $this->product->getEan();
?>
</span>
    </div>
    
    <div class="prod_price" style="margin-bottom:20px;">
        <?php 
print _JSHOP_PRICE;
?>
: 
        <span id="block_price">
            <?php 
print formatprice($this->product->getPriceCalculate());
?>
        </span>
    </div>
    
    <div class="jshop_prod_attributes jshop">
        <?php 
foreach ($this->attributes as $attribut) {
    ?>
            <div class = "row-fluid">
                <div class="span2 attributes_title">
                    <span class="attributes_name" id="attr_name_id_<?php 
    print $attribut->attr_id;
    ?>
"><?php 
    print $attribut->attr_name;
Example #4
0
        print sprintBasicPrice($prod);
        ?>
</span></div>
      <?php 
    }
    ?>
    </td>
    <td>
      <?php 
    print $prod['quantity'];
    print $prod['_qty_unit'];
    ?>
    </td>
    <td>
      <?php 
    print formatprice($prod['price'] * $prod['quantity']);
    ?>
      <?php 
    print $prod['_ext_price_total_html'];
    ?>
      <?php 
    if ($this->config->show_tax_product_in_cart && $prod['tax'] > 0) {
        ?>
            <span class="taxinfo"><?php 
        print productTaxInfo($prod['tax']);
        ?>
</span>
        <?php 
    }
    ?>
    </td>
Example #5
0
    </th>
    <th style="text-align:right;">
      <?php 
echo formatprice($total_sum_m);
?>
 
    </th>
    <th style="text-align:right;">
      <?php 
echo $total_y;
?>
  
    </th>  
    <th style="text-align:right;">
       <?php 
echo formatprice($total_sum_y);
?>
   
    </th>  
  </tr>
</table>
</fieldset>
</div>
<div style="width:40%; float:left;">
<div style="padding-left:5px;">
<fieldset class="adminform">
<legend><?php 
echo _JSHOP_INVENTORY;
?>
</legend>
<table style="width:100%;">
Example #6
0
      ?>
 <td>
  <?php 
      if ($row->unlimited) {
          print _JSHOP_UNLIMITED;
      } else {
          echo $row->qty;
      }
      ?>
 </td>
 <?php 
  }
  ?>
 <td>
  <?php 
  echo formatprice($row->product_price, sprintCurrency($row->currency_id));
  ?>
 </td>
 <td>
  <?php 
  echo $row->hits;
  ?>
 </td>
 <td>
  <?php 
  echo formatdate($row->product_date_added, 1);
  ?>
 </td>
 <?php 
  if ($category_id) {
      ?>
Example #7
0
            </tr>
        <?php 
    }
    ?>
        
        <?php 
    if ($this->free_discount > 0) {
        ?>
  
            <tr class="free_discount">
                <td colspan="2" align="right">    
                    <span class="free_discount"><?php 
        print _JSHOP_FREE_DISCOUNT;
        ?>
: <?php 
        print formatprice($this->free_discount);
        ?>
</span>  
                </td>
            </tr>
        <?php 
    }
    ?>
        
    </table>
<?php 
} else {
    ?>
    <div class="cart_empty_text"><?php 
    print _JSHOP_CART_EMPTY;
    ?>
Example #8
0
 - <?php 
                print formatweight($price->shipping_weight_to);
                ?>
                                            <?php 
            } else {
                ?>
                                                <?php 
                print _JSHOP_FROM . " " . formatweight($price->shipping_weight_from);
                ?>
                                            <?php 
            }
            ?>
                                        </td>
                                        <td class="price">
                                            <?php 
            print formatprice($price->shipping_price);
            ?>
                                        </td>
                                    </tr>
                                <?php 
        }
        ?>
                            </table>
                        <?php 
    }
    ?>
                        
                        <div class="shipping_descr"><?php 
    print $shipping->description;
    ?>
</div>
Example #9
0
            ?>
        </td>
      </tr>
    <?php 
        }
    }
    ?>
<tr class="bold">
 <td colspan="4" class="right">
    <?php 
    echo _JSHOP_TOTAL;
    ?>
 </td>
 <td class="left">
   <?php 
    echo formatprice($order->order_total, $order->currency_code);
    print $this->_tmp_ext_total;
    ?>
 </td>
</tr>
<?php 
    print $this->_tmp_html_after_total;
    ?>
</table>
<?php 
}
?>
<br/>

<table class="adminlist">
<thead>
 - <?php 
                echo formatweight($price->shipping_weight_to);
                ?>
								<?php 
            } else {
                ?>
									<?php 
                echo _JSHOP_FROM . " " . formatweight($price->shipping_weight_from);
                ?>
								<?php 
            }
            ?>
							</div>
							<div class="price">
								<?php 
            echo formatprice($price->shipping_price);
            ?>
							</div>
						<?php 
        }
        ?>
						</div>
					<?php 
    }
    ?>
					<div class="shipping_descr"><?php 
    echo $shipping->description;
    ?>
</div>
					<div id="shipping_form_<?php 
    print $shipping->shipping_id;
                   </td>
                 </tr>
               </table>
            </td> 
          </tr>
      </table>
      </div>
      <?php 
    }
    ?>
      <div class="myorders_total">
        <?php 
    print _JSHOP_TOTAL;
    ?>
: <span><?php 
    print formatprice($this->total, getMainCurrencyCode());
    ?>
</span>
      </div>
    <?php 
} else {
    ?>
        <div class="myorders_no_orders">
        <?php 
    print _JSHOP_NO_ORDERS;
    ?>
        </div>
    <?php 
}
?>
    <?php 
Example #12
0
 function getBuildSelectAttributes($attributeValues, $attributeActive, $displayonlyattrtype = null)
 {
     $jshopConfig = JSFactory::getConfig();
     if (!$jshopConfig->admin_show_attributes) {
         return array();
     }
     $dispatcher = JDispatcher::getInstance();
     $attrib = JSFactory::getAllAttributes();
     $userShop = JSFactory::getUserShop();
     $selects = array();
     foreach ($attrib as $k => $v) {
         $attr_id = $v->attr_id;
         if ($displayonlyattrtype) {
             $v->attr_type = $displayonlyattrtype;
         }
         if (isset($attributeValues[$attr_id]) && $attributeValues[$attr_id]) {
             if (isset($attributeActive[$attr_id])) {
                 $_firstval = $attributeActive[$attr_id];
             } else {
                 $_firstval = 0;
             }
             $selects[$attr_id] = new stdClass();
             $selects[$attr_id]->attr_id = $attr_id;
             $selects[$attr_id]->attr_name = $v->name;
             $selects[$attr_id]->attr_description = $v->description;
             $selects[$attr_id]->groupname = $v->groupname;
             $selects[$attr_id]->firstval = $_firstval;
             $options = $attributeValues[$attr_id];
             $attrimage = array();
             foreach ($options as $k2 => $v2) {
                 $attrimage[$v2->val_id] = $v2->image;
                 $addPrice = $v2->addprice;
                 $addPrice = getPriceFromCurrency($addPrice, $this->currency_id);
                 $addPrice = getPriceCalcParamsTax($addPrice, $this->product_tax_id);
                 if ($userShop->percent_discount) {
                     $addPrice = getPriceDiscount($addPrice, $userShop->percent_discount);
                 }
                 $options[$k2]->addprice = $addPrice;
             }
             if ($v->attr_type == 1) {
                 // attribut type select
                 if ($jshopConfig->attr_display_addprice) {
                     foreach ($options as $k2 => $v2) {
                         if (($v2->price_mod == "+" || $v2->price_mod == "-" || $jshopConfig->attr_display_addprice_all_sign) && $v2->addprice > 0) {
                             $ext_price_info = " (" . $v2->price_mod . formatprice($v2->addprice, null, 0, -1) . ")";
                             $options[$k2]->value_name .= $ext_price_info;
                         }
                     }
                 }
                 if ($jshopConfig->product_attribut_first_value_empty) {
                     $first = array();
                     $first[] = JHTML::_('select.option', '0', _JSHOP_SELECT, 'val_id', 'value_name');
                     $options = array_merge($first, $options);
                 }
                 if (isset($attributeActive[$attr_id]) && isset($attrimage[$attributeActive[$attr_id]])) {
                     $_active_image = $attrimage[$attributeActive[$attr_id]];
                 } else {
                     $_active_image = '';
                 }
                 if (isset($attributeActive[$attr_id])) {
                     $_select_active = $attributeActive[$attr_id];
                 } else {
                     $_select_active = '';
                 }
                 $html_select_attribute_param = 'class="' . $jshopConfig->frontend_attribute_select_class_css . '" size = "' . $jshopConfig->frontend_attribute_select_size . '" onchange="setAttrValue(\'' . $attr_id . '\', this.value);"';
                 $selects[$attr_id]->selects = JHTML::_('select.genericlist', $options, 'jshop_attr_id[' . $attr_id . ']', $html_select_attribute_param, 'val_id', 'value_name', $_select_active) . "<span class='prod_attr_img'>" . $this->getHtmlDisplayProdAttrImg($attr_id, $_active_image) . "</span>";
                 $selects[$attr_id]->selects = str_replace(array("\n", "\r", "\t"), "", $selects[$attr_id]->selects);
             } else {
                 // attribut type radio
                 foreach ($options as $k2 => $v2) {
                     if ($v2->image) {
                         $options[$k2]->value_name = "<img src='" . $jshopConfig->image_attributes_live_path . "/" . $v2->image . "' alt='' /> " . $v2->value_name;
                     }
                 }
                 if ($jshopConfig->attr_display_addprice) {
                     foreach ($options as $k2 => $v2) {
                         if (($v2->price_mod == "+" || $v2->price_mod == "-" || $jshopConfig->attr_display_addprice_all_sign) && $v2->addprice > 0) {
                             $ext_price_info = " (" . $v2->price_mod . formatprice($v2->addprice) . ")";
                             $options[$k2]->value_name .= $ext_price_info;
                         }
                     }
                 }
                 $radioseparator = '';
                 if ($jshopConfig->radio_attr_value_vertical) {
                     $radioseparator = "<br/>";
                 }
                 foreach ($options as $k2 => $v2) {
                     $options[$k2]->value_name = "<span class='radio_attr_label'>" . $v2->value_name . "</span>";
                 }
                 $selects[$attr_id]->selects = sprintRadioList($options, 'jshop_attr_id[' . $attr_id . ']', 'onclick="setAttrValue(\'' . $attr_id . '\', this.value);"', 'val_id', 'value_name', $attributeActive[$attr_id], $radioseparator);
                 $selects[$attr_id]->selects = str_replace(array("\n", "\r", "\t"), "", $selects[$attr_id]->selects);
             }
             $dispatcher->trigger('onBuildSelectAttribute', array(&$attributeValues, &$attributeActive, &$selects, &$options, &$attr_id, &$v));
         }
     }
     $grname = '';
     foreach ($selects as $k => $v) {
         if ($v->groupname != $grname) {
             $grname = $v->groupname;
             $selects[$k]->grshow = 1;
         } else {
             $selects[$k]->grshow = 0;
         }
     }
     return $selects;
 }
 public function getCheckoutListPayments()
 {
     $jshopConfig = JSFactory::getConfig();
     $cart = $this->getCart();
     $paymentmethod = JSFactory::getTable('paymentmethod', 'jshop');
     $shipping_id = $cart->getShippingId();
     $all_payment_methods = $paymentmethod->getAllPaymentMethods(1, $shipping_id);
     $i = 0;
     $paym = array();
     foreach ($all_payment_methods as $pm) {
         $paym[$i] = new stdClass();
         if ($pm->scriptname != '') {
             $scriptname = $pm->scriptname;
         } else {
             $scriptname = $pm->payment_class;
         }
         $paymentmethod->load($pm->payment_id);
         $paymentsysdata = $paymentmethod->getPaymentSystemData($scriptname);
         if ($paymentsysdata->paymentSystem) {
             $paym[$i]->existentcheckform = 1;
             $paym[$i]->payment_system = $paymentsysdata->paymentSystem;
         } else {
             $paym[$i]->existentcheckform = 0;
         }
         $paym[$i]->name = $pm->name;
         $paym[$i]->payment_id = $pm->payment_id;
         $paym[$i]->payment_class = $pm->payment_class;
         $paym[$i]->scriptname = $pm->scriptname;
         $paym[$i]->payment_description = $pm->description;
         $paym[$i]->price_type = $pm->price_type;
         $paym[$i]->image = $pm->image;
         $paym[$i]->price_add_text = '';
         if ($pm->price_type == 2) {
             $paym[$i]->calculeprice = $pm->price;
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . $paym[$i]->calculeprice . '%';
                 } else {
                     $paym[$i]->price_add_text = $paym[$i]->calculeprice . '%';
                 }
             }
         } else {
             $paym[$i]->calculeprice = getPriceCalcParamsTax($pm->price * $jshopConfig->currency_value, $pm->tax_id, $cart->products);
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . formatprice($paym[$i]->calculeprice);
                 } else {
                     $paym[$i]->price_add_text = formatprice($paym[$i]->calculeprice);
                 }
             }
         }
         $s_payment_method_id = $cart->getPaymentId();
         if ($s_payment_method_id == $pm->payment_id) {
             $params = $cart->getPaymentParams();
         } else {
             $params = array();
         }
         $parseString = new parseString($pm->payment_params);
         $pmconfig = $parseString->parseStringToParams();
         if ($paym[$i]->existentcheckform) {
             $paym[$i]->form = $paymentmethod->loadPaymentForm($paym[$i]->payment_system, $params, $pmconfig);
         } else {
             $paym[$i]->form = "";
         }
         $i++;
     }
     return $paym;
 }
Example #14
0
&shipping_id_back=<?php 
        print $this->shipping_id_back;
        ?>
"><?php 
        echo $sh_price->name;
        ?>
</a>
		</td>
        <td>
            <?php 
        print $sh_price->countries;
        ?>
        </td>
        <td>
            <?php 
        print formatprice($sh_price->shipping_stand_price);
        ?>
        </td>
		<td align="center">
            <a href='index.php?option=com_jshopping&controller=shippingsprices&task=edit&sh_pr_method_id=<?php 
        echo $sh_price->sh_pr_method_id;
        ?>
&shipping_id_back=<?php 
        print $this->shipping_id_back;
        ?>
'><img src='components/com_jshopping/images/icon-16-edit.png'></a>
	   </td>
       <td align="center">
        <?php 
        print $sh_price->sh_pr_method_id;
        ?>
Example #15
0
        print $prod['href_delete'];
        ?>
" class="cart-delete" onclick="return confirm('<?php 
        print _JSHOP_CONFIRM_REMOVE;
        ?>
')"><i class="fa fa-trash-o"></i></a></td>
      </tr>
      <?php 
    }
    ?>
      </tbody>
    </table>
  </div>
  <div class="text-right">
    Сумма &nbsp;&nbsp;<span class="product-card-price"><?php 
    print formatprice($this->summ);
    ?>
</span><br><br>
    <input type="submit" class="btn btn-success" value="Оформить заказ">
  </div>
  <?php 
    print $this->_tmp_html_after_buttons;
} else {
    ?>
  <div class="alert alert-info text-center" role="alert">
    <?php 
    print _JSHOP_CART_EMPTY;
    ?>
  </div>
<?php 
}
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;
}
Example #17
0
 function ajax_attrib_select_and_price()
 {
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     $display_price = JRequest::getVar('display_price');
     $jshopConfig->setDisplayPriceFront($display_price);
     $product_id = JRequest::getInt('product_id');
     $change_attr = JRequest::getInt('change_attr');
     if ($jshopConfig->use_decimal_qty) {
         $qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
     } else {
         $qty = JRequest::getInt('qty', 1);
     }
     if ($qty < 0) {
         $qty = 1;
     }
     $attribs = JRequest::getVar('attr');
     if (!is_array($attribs)) {
         $attribs = array();
     }
     $freeattr = array();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
     $product = JSFactory::getTable('product', 'jshop');
     $product->load($product_id);
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
     $attributesDatas = $product->getAttributesDatas($attribs);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $product->setFreeAttributeActive($freeattr);
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected'], 1);
     $rows = array();
     foreach ($attributes as $k => $v) {
         $rows[] = '"id_' . $k . '":"' . json_value_encode($v->selects, 1) . '"';
     }
     $pricefloat = $product->getPrice($qty, 1, 1, 1);
     $price = formatprice($pricefloat);
     $available = intval($product->getQty() > 0);
     $ean = $product->getEan();
     $weight = $product->getWeight();
     $rows[] = '"price":"' . json_value_encode($price) . '"';
     $rows[] = '"pricefloat":"' . $pricefloat . '"';
     $rows[] = '"available":"' . $available . '"';
     $rows[] = '"ean":"' . json_value_encode($ean) . '"';
     $rows[] = '"weight":"' . json_value_encode($weight) . '"';
     $qty_in_stock = getDataProductQtyInStock($product);
     $rows[] = '"qty":"' . json_value_encode(sprintQtyInStock($qty_in_stock)) . '"';
     $product->updateOtherPricesIncludeAllFactors();
     $dispatcher->trigger('onBeforeDisplayAjaxAttrib', array(&$rows, &$product));
     print '{' . implode(",", $rows) . '}';
     die;
 }
Example #18
0
 /**
  * get attributes html selects, price for select attribute 
  */
 function ajax_attrib_select_and_price()
 {
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     $product_id = JRequest::getInt('product_id');
     $change_attr = JRequest::getInt('change_attr');
     if ($jshopConfig->use_decimal_qty) {
         $qty = floatval(str_replace(",", ".", JRequest::getVar('qty', 1)));
     } else {
         $qty = JRequest::getInt('qty', 1);
     }
     if ($qty < 0) {
         $qty = 0;
     }
     $attribs = JRequest::getVar('attr');
     if (!is_array($attribs)) {
         $attribs = array();
     }
     $freeattr = JRequest::getVar('freeattr');
     if (!is_array($freeattr)) {
         $freeattr = array();
     }
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib', array(&$product_id, &$change_attr, &$qty, &$attribs, &$freeattr));
     $product = JTable::getInstance('product', 'jshop');
     $product->load($product_id);
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
     $attributesDatas = $product->getAttributesDatas($attribs);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $product->setFreeAttributeActive($freeattr);
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
     $rows = array();
     foreach ($attributes as $k => $v) {
         $v->selects = str_replace(array("\n", "\r", "\t"), "", $v->selects);
         $rows[] = '"id_' . $k . '":"' . str_replace('"', '\\"', $v->selects) . '"';
     }
     $pricefloat = $product->getPrice($qty, 1, 1, 1);
     $price = formatprice($pricefloat);
     $available = intval($product->getQty() > 0);
     $displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
     $ean = $product->getEan();
     $weight = formatweight($product->getWeight());
     $basicprice = formatprice($product->getBasicPrice());
     $rows[] = '"price":"' . $price . '"';
     $rows[] = '"pricefloat":"' . $pricefloat . '"';
     $rows[] = '"available":"' . $available . '"';
     $rows[] = '"ean":"' . $ean . '"';
     if ($jshopConfig->admin_show_product_basic_price) {
         $rows[] = '"basicprice":"' . $basicprice . '"';
     }
     if ($jshopConfig->product_show_weight) {
         $rows[] = '"weight":"' . $weight . '"';
     }
     if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
         $rows[] = '"pricedefault":"' . formatprice($product->product_price_default) . '"';
     }
     if ($jshopConfig->product_show_qty_stock) {
         $qty_in_stock = getDataProductQtyInStock($product);
         $rows[] = '"qty":"' . sprintQtyInStock($qty_in_stock) . '"';
     }
     $product->updateOtherPricesIncludeAllFactors();
     if (is_array($product->product_add_prices)) {
         foreach ($product->product_add_prices as $k => $v) {
             $rows[] = '"pq_' . $v->product_quantity_start . '":"' . str_replace('"', '\\"', formatprice($v->price)) . '"';
         }
     }
     if ($product->product_old_price) {
         $old_price = formatprice($product->product_old_price);
         $rows[] = '"oldprice":"' . $old_price . '"';
     }
     $rows[] = '"displaybuttons":"' . $displaybuttons . '"';
     if ($jshopConfig->use_extend_attribute_data) {
         $images = $product->getImages();
         $videos = $product->getVideos();
         $demofiles = $product->getDemoFiles();
         $tmp = array();
         foreach ($images as $img) {
             $tmp[] = '"' . $img->image_name . '"';
         }
         $displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
         $rows[] = '"images":[' . implode(",", $tmp) . '],"displayimgthumb":"' . $displayimgthumb . '"';
         $view_name = "product";
         $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
         $view = $this->getView($view_name, getDocumentType(), '', $view_config);
         $view->setLayout("demofiles");
         $view->assign('config', $jshopConfig);
         $view->assign('demofiles', $demofiles);
         $demofiles = $view->loadTemplate();
         $demofiles = str_replace(array("\n", "\r", "\t"), "", $demofiles);
         $rows[] = '"demofiles":"' . str_replace('"', '\\"', $demofiles) . '"';
     }
     $dispatcher->trigger('onBeforeDisplayAjaxAttrib', array(&$rows, &$product));
     print '{' . implode(",", $rows) . '}';
     die;
 }
 /**
  * добавляет область выборат способов оплаты
  */
 public function addPaymentMethods()
 {
     $cart = JSFactory::getModel('cart', 'jshop');
     $cart->load();
     $paymentmethod = JSFactory::getTable('paymentmethod', 'jshop');
     $shipping_id = $cart->getShippingId();
     $all_payment_methods = $paymentmethod->getAllPaymentMethods(1, $shipping_id);
     $i = 0;
     $paym = array();
     foreach ($all_payment_methods as $pm) {
         $paym[$i] = new stdClass();
         if ($pm->scriptname != '') {
             $scriptname = $pm->scriptname;
         } else {
             $scriptname = $pm->payment_class;
         }
         $paymentmethod->load($pm->payment_id);
         $paymentsysdata = $paymentmethod->getPaymentSystemData($scriptname);
         if ($paymentsysdata->paymentSystem) {
             $paym[$i]->existentcheckform = 1;
             $paym[$i]->payment_system = $paymentsysdata->paymentSystem;
         } else {
             $paym[$i]->existentcheckform = 0;
         }
         $paym[$i]->name = $pm->name;
         $paym[$i]->payment_id = $pm->payment_id;
         $paym[$i]->payment_class = $pm->payment_class;
         $paym[$i]->scriptname = $pm->scriptname;
         $paym[$i]->payment_description = $pm->description;
         $paym[$i]->price_type = $pm->price_type;
         $paym[$i]->image = $pm->image;
         $paym[$i]->price_add_text = '';
         if ($pm->price_type == 2) {
             $paym[$i]->calculeprice = $pm->price;
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . $paym[$i]->calculeprice . '%';
                 } else {
                     $paym[$i]->price_add_text = $paym[$i]->calculeprice . '%';
                 }
             }
         } else {
             $paym[$i]->calculeprice = getPriceCalcParamsTax($pm->price * $jshopConfig->currency_value, $pm->tax_id, $cart->products);
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . formatprice($paym[$i]->calculeprice);
                 } else {
                     $paym[$i]->price_add_text = formatprice($paym[$i]->calculeprice);
                 }
             }
         }
         $s_payment_method_id = $cart->getPaymentId();
         if ($s_payment_method_id == $pm->payment_id) {
             $params = $cart->getPaymentParams();
         } else {
             $params = array();
         }
         $parseString = new parseString($pm->payment_params);
         $pmconfig = $parseString->parseStringToParams();
         if ($paym[$i]->existentcheckform) {
             $paym[$i]->form = $paymentmethod->loadPaymentForm($paym[$i]->payment_system, $params, $pmconfig);
         } else {
             $paym[$i]->form = "";
         }
         $i++;
     }
     $s_payment_method_id = $cart->getPaymentId();
     $active_payment = intval($s_payment_method_id);
     if (!$active_payment) {
         $list_payment_id = array();
         foreach ($paym as $v) {
             $list_payment_id[] = $v->payment_id;
         }
         if (in_array($adv_user->payment_id, $list_payment_id)) {
             $active_payment = $adv_user->payment_id;
         }
     }
     if (!$active_payment) {
         if (isset($paym[0])) {
             $active_payment = $paym[0]->payment_id;
         }
     }
     $html = '';
     $html .= '<h2>' . _JSHOP_STEP_ORDER_3 . '</h2>';
     $html .= '<div id="table_payments" class="form-inline">';
     $payment_class = "";
     foreach ($paym as $payment) {
         if ($active_payment == $payment->payment_id) {
             $payment_class = $payment->payment_class;
         }
         $html .= '<div class="name">';
         if ($active_payment == $payment->payment_id) {
             $checked = 'checked';
         } else {
             $checked = '';
         }
         $html .= '<input type="radio" name="payment_method" id="payment_method_' . $payment->payment_id . '" onclick="showPaymentForm(\'' . $payment->payment_class . '\')" value="' . $payment->payment_class . '" ' . $checked . ' />';
         $html .= ' <label for = "payment_method_' . $payment->payment_id . '">';
         if ($payment->image) {
             $html .= '<span class="payment_image"><img src="' . $payment->image . '" alt="' . htmlspecialchars($payment->name) . '" /></span>';
         }
         $html .= '<b>' . $payment->name . '</b>';
         if ($payment->price_add_text != '') {
             $html .= '<span class="payment_price">(' . $payment->price_add_text . ')</span>';
         }
         $html .= '</label>';
         $html .= '';
         $html .= ' </div>';
         $html .= '';
     }
     $html .= ' </div>';
     $html .= '';
     return $html;
 }
Example #20
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_SITE . "/components/com_jshopping/lib/factory.php";
     $jshopConfig = JSFactory::getConfig();
     $lang = JSFactory::getLang();
     $session = JFactory::getSession();
     $data = array();
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('joomshoppingproductssourcecategory', '')));
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'pr_cat.category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('joomshoppingproductssourcepublished', 1)) {
         $where[] = ' pr.product_publish = 1 ';
     }
     if ($this->_data->get('joomshoppingproductssourceinstock', 0)) {
         $where[] = ' (pr.product_quantity > 0 OR pr.unlimited = 1) ';
     }
     if ($labelid = $this->_data->get('joomshoppingproductssourcelabel', 0)) {
         $where[] = ' pr.label_id = "' . $labelid . '" ';
     }
     $o = '';
     $order = NextendParse::parse($this->_data->get('joomshoppingproductsorder1', 'pr.name|*|asc'));
     if ($order[0]) {
         if ($order[0] == 'pr.name') {
             $order[0] = 'pr.`' . $lang->get('name') . '`';
         }
         $o .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('joomshoppingproductsorder2', 'pr.name|*|asc'));
         if ($order[0]) {
             if ($order[0] == 'pr.name') {
                 $order[0] = 'pr.`' . $lang->get('name') . '`';
             }
             $o .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query = "SELECT \r\n                        pr.product_id, \r\n                        pr.product_publish, \r\n                        pr_cat.product_ordering, \r\n                        pr.`" . $lang->get('name') . "` as name, \r\n                        pr.`" . $lang->get('short_description') . "` as short_description, \r\n                        man.`" . $lang->get('name') . "` as man_name, \r\n                        pr.product_ean as ean, \r\n                        pr.product_quantity as qty, \r\n                        pri.image_name as image, \r\n                        pr.product_price,\r\n                        pr.currency_id, \r\n                        pr.hits, \r\n                        pr.unlimited, \r\n                        pr.product_date_added, \r\n                        pr.label_id, \r\n                        pr.vendor_id, \r\n                        V.f_name as v_f_name, \r\n                        V.l_name as v_l_name,\r\n                        cat.category_image,\r\n                        cat.category_id,\r\n                        cat.`" . $lang->get('name') . "` as category_name, \r\n                        cat.`" . $lang->get('alias') . "` as category_alias, \r\n                        cat.`" . $lang->get('short_description') . "` as category_short_description, \r\n                        cat.`" . $lang->get('description') . "` as category_description\r\n                    FROM `#__jshopping_products` AS pr\r\n                    LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat USING (product_id)\r\n                    LEFT JOIN `#__jshopping_categories` AS cat USING (category_id)\r\n                    LEFT JOIN `#__jshopping_manufacturers` AS man ON pr.product_manufacturer_id=man.manufacturer_id\r\n                    LEFT JOIN `#__jshopping_vendors` as V on pr.vendor_id=V.id\r\n                    LEFT JOIN `#__jshopping_products_images` as pri on pr.product_id=pri.product_id\r\n                    WHERE pr.parent_id=0 " . (count($where) ? ' AND ' . implode(' AND ', $where) : '') . " GROUP BY pr.product_id " . $o . " LIMIT 0, " . $number;
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $product = JTable::getInstance('product', 'jshop');
         $product->load($result[$i]['product_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;
         }
         $attributesDatas = $product->getAttributesDatas($back_value['attr']);
         $product->setAttributeActive($attributesDatas['attributeActive']);
         getDisplayPriceForProduct($product->product_price);
         $product->getExtendsData();
         $result[$i]['title'] = $result[$i]['name'];
         $result[$i]['price'] = formatprice($product->getPriceCalculate());
         $op = $product->getOldPrice();
         $result[$i]['product_old_price'] = $op > 0 ? formatprice($op) : '';
         $result[$i]['url'] = SEFLink('index.php?option=com_jshopping&controller=product&task=view&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']);
         $result[$i]['category_url'] = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $result[$i]['category_id']);
         $result[$i]['addtocart'] = $result[$i]['add_to_cart_url'] = SEFLink('index.php?option=com_jshopping&controller=cart&task=add&quantity=1&to=cart&product_id=' . $result[$i]['product_id'] . '&category_id=' . $result[$i]['category_id']);
         $result[$i]['addtocart_label'] = 'Add to cart';
         $result[$i]['image_full'] = $jshopConfig->image_product_live_path . '/full_' . $result[$i]['image'];
         $result[$i]['thumbnail'] = $result[$i]['image_thumb'] = $jshopConfig->image_product_live_path . '/thumb_' . $result[$i]['image'];
         $result[$i]['image'] = $jshopConfig->image_product_live_path . '/' . $result[$i]['image'];
     }
     return $result;
 }
Example #21
0
 public function getList()
 {
     /**
      * Get data 
      */
     $db = JFactory::getDBO();
     $data = array();
     //select from
     $source = trim($this->_params->get('source', 'js_categories'));
     if ($source == 'js_categories') {
         $catids = $this->_params->get('js_categories', '');
     } else {
         if ($this->_params->get('js_ids', '')) {
             $ids = preg_split('/,/', $this->_params->get('js_ids', ''));
             $ids_tmp = array();
             foreach ($ids as $id) {
                 $ids_tmp[] = (int) trim($id);
             }
         }
     }
     if ($source == 'js_categories' && $catids && $this->_params->get('limit_items_for_each')) {
         foreach ($catids as $catid) {
             $query = $this->buildQuery($catid);
             $db->setQuery($query);
             $data = array_merge($data, $db->loadObjectlist());
         }
     } else {
         if ($source == 'js_categories' && $catids) {
             $query = $this->buildQuery($catids);
             $db->setQuery($query);
             $data = array_merge($data, $db->loadObjectlist());
         } else {
             if ($source == 'js_ids' && $ids_tmp && count($ids_tmp)) {
                 $query = $this->buildQuery(false, $ids_tmp);
                 $db->setQuery($query);
                 $data = array_merge($data, $db->loadObjectlist());
             } else {
                 $query = $this->buildQuery(false, false);
                 $db->setQuery($query);
                 $data = array_merge($data, $db->loadObjectlist());
             }
         }
     }
     //add link
     if (!class_exists('JSFactory')) {
         return null;
     }
     $jshopConfig = JSFactory::getConfig();
     $userShop = JSFactory::getUserShop();
     foreach ($data as $product) {
         $product->link = SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $product->category_id . '&product_id=' . $product->id, 1);
         if ($jshopConfig->show_buy_in_category) {
             if (!($jshopConfig->hide_buy_not_avaible_stock && $product->product_quantity <= 0)) {
                 $product->add_to_cart = '<a class="bt-addtocart" href="' . SEFLink('index.php?option=com_jshopping&controller=cart&task=add&category_id=' . $product->category_id . '&product_id=' . $product->id, 1) . '" title="' . sprintf(JText::_('ADD_PRODUCT_TO_CART'), $product->name) . '">' . JText::_('ADD_TO_CART') . '</a>';
             }
         }
         if ($jshopConfig->image_product_live_path) {
             $product->thumbnail = $jshopConfig->image_product_live_path . '/' . $product->thumbnail;
         }
         $product->category_link = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $product->category_id, 1);
         //calculate price
         $product->product_price = getPriceFromCurrency($product->product_price, $product->currency_id);
         $product->product_old_price = getPriceFromCurrency($product->product_old_price, $product->currency_id);
         $product->product_price = getPriceCalcParamsTax($product->product_price, $product->product_tax_id);
         $product->product_old_price = getPriceCalcParamsTax($product->product_old_price, $product->product_tax_id);
         if ($userShop->percent_discount) {
             $product->product_price = getPriceDiscount($product->product_price, $userShop->percent_discount);
             $product->product_old_price = getPriceDiscount($product->product_old_price, $userShop->percent_discount);
         }
         $product->old_price = '';
         if ($product->product_old_price) {
             $product->old_price = formatprice($product->product_old_price);
         }
         if ($product->product_price) {
             $product->sales_price = formatprice($product->product_price);
         }
         // title cut
         $titleMaxChars = $this->_params->get('title_max_chars', '100');
         $limit_title_by = $this->_params->get('limit_title_by', 'char');
         $replacer = $this->_params->get('replacer', '...');
         $isStrips = $this->_params->get("auto_strip_tags", 1);
         $stringtags = '';
         if ($limit_title_by == 'word' && $titleMaxChars > 0) {
             $product->name_cut = self::substrword($product->name, $titleMaxChars, $replacer, $isStrips);
         } elseif ($limit_title_by == 'char' && $titleMaxChars > 0) {
             $product->name_cut = self::substring($product->name, $titleMaxChars, $replacer, $isStrips);
         }
     }
     if (empty($data)) {
         return array();
     }
     /**
      * Get display and config params 
      */
     /* title */
     $isStrips = $this->_params->get("auto_strip_tags", 1);
     $stringtags = '';
     if ($isStrips) {
         $allow_tags = $this->_params->get("allow_tags", '');
         $stringtags = '';
         if (!is_array($allow_tags)) {
             $allow_tags = explode(',', $allow_tags);
         }
         foreach ($allow_tags as $tag) {
             $stringtags .= '<' . $tag . '>';
         }
     }
     if (!$this->_params->get('default_thumb', 1)) {
         $this->_defaultThumb = '';
     }
     /* intro */
     $maxDesciption = $this->_params->get('description_max_chars', 100);
     $limitDescriptionBy = $this->_params->get('limit_description_by', 'char');
     $isThumb = $this->_params->get('image_thumb', 1);
     $dateFormat = $this->_params->get('date_format', 'DATE_FORMAT_LC3');
     foreach ($data as $key => &$product) {
         if ($this->_params->get('show_date')) {
             $product->date = JHtml::_('date', $product->created_on, JText::_($dateFormat));
         }
         if ($this->_params->get('show_intro')) {
             if ($limitDescriptionBy == 'word') {
                 $product->description = self::substrword($product->introtext, $maxDesciption, $stringtags);
             } else {
                 $product->description = self::substring($product->introtext, $maxDesciption, $stringtags);
             }
         }
         //if show image
         if ($this->_params->get('show_image')) {
             $product->thumbnail = explode(',', $product->thumbnail);
             $thumbnail = '';
             foreach ($product->thumbnail as $tmpThumbnail) {
                 $type = explode('.', $tmpThumbnail);
                 $type = strtolower($type[count($type) - 1]);
                 if (in_array($type, array('jpg', 'jpeg', 'png', 'png'))) {
                     $thumbnail = $tmpThumbnail;
                     break;
                 }
             }
             $product->thumbnail = $thumbnail;
             $product = $this->generateImages($product, $isThumb);
         }
         //get label
         $product->label_image = $product->label_image ? $jshopConfig->image_labels_live_path . "/" . $product->label_image : '';
         if ($this->_params->get('show_manufacturer')) {
             $product->manufacturer_link = SEFLink('index.php?option=com_jshopping&controller=manufacturer&task=view&manufacturer_id=' . $product->product_manufacturer_id);
         }
     }
     if ($this->_params->get('show_rating')) {
         foreach ($data as $key => &$product) {
             $count = floor($jshopConfig->max_mark / $jshopConfig->rating_starparts);
             $width = $count * 16;
             $rating = round($product->rating);
             $product->ratingSpan = '<span class="vote">';
             if (empty($rating)) {
                 $product->ratingSpan .= '<span style="width: ' . $width . 'px;" title="' . JText::_("RATING_UNRATE") . '" class="ratingbox" style="display:inline-block;">';
             } else {
                 $width_active = intval($rating * 16 / $jshopConfig->rating_starparts);
                 $product->ratingSpan .= '<span style="width: ' . $width . 'px;" title="' . JText::_("RATING") . ' ' . $rating . '/' . $jshopConfig->max_mark . '" class="ratingbox" style="display:inline-block;">';
                 $product->ratingSpan .= '<span class="ratingactive" style="width: ' . $width_active . 'px"></span>';
             }
             $product->ratingSpan .= '</span></span>';
         }
     }
     return $data;
 }
 public function getLoadProductData()
 {
     $jshopConfig = JSFactory::getConfig();
     $dispatcher = JDispatcher::getInstance();
     $product = $this->product;
     $product->load($this->product_id);
     $dispatcher->trigger('onBeforeLoadDisplayAjaxAttrib2', array(&$product));
     $attributes = $product->getInitLoadAttribute($this->attribs);
     $product->setFreeAttributeActive($this->freeattr);
     $rows = array();
     foreach ($attributes as $k => $v) {
         $rows['id_' . $k] = $v->selects;
     }
     $pricefloat = $product->getPrice($this->qty, 1, 1, 1);
     $price = formatprice($pricefloat);
     $available = intval($product->getQty() > 0);
     $displaybuttons = intval(intval($product->getQty() > 0) || $jshopConfig->hide_buy_not_avaible_stock == 0);
     $ean = $product->getEan();
     $weight = formatweight($product->getWeight());
     $basicprice = formatprice($product->getBasicPrice());
     $rows['price'] = $price;
     $rows['pricefloat'] = $pricefloat;
     $rows['available'] = $available;
     $rows['ean'] = $ean;
     if ($jshopConfig->admin_show_product_basic_price) {
         $rows['basicprice'] = $basicprice;
     }
     if ($jshopConfig->product_show_weight) {
         $rows['weight'] = $weight;
     }
     if ($jshopConfig->product_list_show_price_default && $product->product_price_default > 0) {
         $rows['pricedefault'] = formatprice($product->product_price_default);
     }
     if ($jshopConfig->product_show_qty_stock) {
         $qty_in_stock = getDataProductQtyInStock($product);
         $rows['qty'] = sprintQtyInStock($qty_in_stock);
     }
     $product->updateOtherPricesIncludeAllFactors();
     if (is_array($product->product_add_prices)) {
         foreach ($product->product_add_prices as $k => $v) {
             $rows['pq_' . $v->product_quantity_start] = formatprice($v->price);
         }
     }
     if ($product->product_old_price) {
         $old_price = formatprice($product->product_old_price);
         $rows['oldprice'] = $old_price;
     }
     $rows['displaybuttons'] = $displaybuttons;
     if ($jshopConfig->hide_delivery_time_out_of_stock) {
         $rows['showdeliverytime'] = $product->getDeliveryTimeId();
     }
     if ($jshopConfig->use_extend_attribute_data) {
         $template_path = $jshopConfig->template_path . $jshopConfig->template . "/product";
         $images = $product->getImages();
         $videos = $product->getVideos();
         $demofiles = $product->getDemoFiles();
         if (!file_exists($template_path . "/block_image_thumb.php")) {
             $tmp = array();
             foreach ($images as $img) {
                 $tmp[] = $img->image_name;
             }
             $displayimgthumb = intval(count($images) > 1 || count($videos) && count($images));
             $rows['images'] = $tmp;
             $rows['displayimgthumb'] = $displayimgthumb;
         }
         $view = $this->getView("product");
         $view->setLayout("demofiles");
         $view->assign('config', $jshopConfig);
         $view->assign('demofiles', $demofiles);
         $demofiles = $view->loadTemplate();
         $rows['demofiles'] = $demofiles;
         if (file_exists($template_path . "/block_image_thumb.php")) {
             $product->getDescription();
             $view = $this->getView("product");
             $view->setLayout("block_image_thumb");
             $view->assign('config', $jshopConfig);
             $view->assign('images', $images);
             $view->assign('videos', $videos);
             $view->assign('image_product_path', $jshopConfig->image_product_live_path);
             $dispatcher->trigger('onBeforeDisplayProductViewBlockImageThumb', array(&$view));
             $block_image_thumb = $view->loadTemplate();
             $view = $this->getView("product");
             $view->setLayout("block_image_middle");
             $view->assign('config', $jshopConfig);
             $view->assign('images', $images);
             $view->assign('videos', $videos);
             $view->assign('product', $product);
             $view->assign('noimage', $jshopConfig->noimage);
             $view->assign('image_product_path', $jshopConfig->image_product_live_path);
             $view->assign('path_to_image', $jshopConfig->live_path . 'images/');
             $dispatcher->trigger('onBeforeDisplayProductViewBlockImageMiddle', array(&$view));
             $block_image_middle = $view->loadTemplate();
             $rows['block_image_thumb'] = $block_image_thumb;
             $rows['block_image_middle'] = $block_image_middle;
         }
     }
     $dispatcher->trigger('onBeforeDisplayAjaxAttribRows', array(&$rows, &$this));
     return $rows;
 }
Example #23
0
function sprintBasicPrice($prod)
{
    if (is_object($prod)) {
        $prod = (array) $prod;
    }
    JPluginHelper::importPlugin('jshoppingproducts');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('beforeSprintBasicPrice', array(&$prod));
    $html = '';
    if ($prod['basicprice'] > 0) {
        $html = formatprice($prod['basicprice']) . " / " . $prod['basicpriceunit'];
    }
    return $html;
}
 function checkStep($step)
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     if ($step < 10) {
         if (!$jshopConfig->shop_user_guest) {
             checkUserLogin();
         }
         $cart = JSFactory::getModel('cart', 'jshop');
         $cart->load();
         if ($cart->getCountProduct() == 0) {
             JError::raiseWarning("", _JSHOP_NO_SELECT_PRODUCT);
             $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1));
             exit;
         }
         if ($jshopConfig->min_price_order && $cart->getPriceProducts() < $jshopConfig->min_price_order * $jshopConfig->currency_value) {
             JError::raiseNotice("", sprintf(_JSHOP_ERROR_MIN_SUM_ORDER, formatprice($jshopConfig->min_price_order * $jshopConfig->currency_value)));
             $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1));
             exit;
         }
         if ($jshopConfig->max_price_order && $cart->getPriceProducts() > $jshopConfig->max_price_order * $jshopConfig->currency_value) {
             JError::raiseNotice("", sprintf(_JSHOP_ERROR_MAX_SUM_ORDER, formatprice($jshopConfig->max_price_order * $jshopConfig->currency_value)));
             $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1));
             exit;
         }
     }
     if ($step > 2) {
         $jhop_max_step = $session->get("jhop_max_step");
         if (!$jhop_max_step) {
             $session->set('jhop_max_step', 2);
             $jhop_max_step = 2;
         }
         if ($step > $jhop_max_step) {
             if ($step == 10) {
                 $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1));
             } else {
                 JError::raiseWarning("", _JHOP_ERROR_STEP);
                 $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 1, 1, $jshopConfig->use_ssl));
             }
             exit;
         }
     }
 }
Example #25
0
&nbsp;&nbsp;</td></tr><tr><td>&nbsp;&nbsp;Giá:&nbsp;<?php 
    echo formatprice($curr->product_price);
    ?>
&nbsp;&nbsp;</td></tr></table>');" onmouseout="tooltip.hide();">
           
       <div class="item_name">  
           <a href="<?php 
    print $curr->product_link;
    ?>
"><?php 
    print $curr->name;
    ?>
</a>
       </div>
       <?php 
    if ($curr->_display_price) {
        ?>
       <div class="item_price" style="color: red;font-weight: bold">
           Giá:&nbsp;<?php 
        print formatprice($curr->product_price);
        ?>
       </div>
           </span>
       <?php 
    }
    ?>
   </div>       
<?php 
}
?>
</div>
Example #26
0
: <span id="block_weight"><?php 
    print formatweight($this->product->getWeight());
    ?>
</span></div>
        <?php 
}
?>

        <?php 
if ($this->product->product_basic_price_show) {
    ?>
            <div class="prod_base_price"><?php 
    print _JSHOP_BASIC_PRICE;
    ?>
: <span id="block_basic_price"><?php 
    print formatprice($this->product->product_basic_price_calculate);
    ?>
</span> / <?php 
    print $this->product->product_basic_price_unit_name;
    ?>
</div>
        <?php 
}
?>
        
        <?php 
print $this->product->_tmp_var_bottom_allprices;
?>

        <?php 
if (is_array($this->product->extra_field)) {
Example #27
0
        <?php 
}
?>
        <?php 
if ($product->basic_price_info['price_show']) {
    ?>
            <div class="base_price"><?php 
    print _JSHOP_BASIC_PRICE;
    ?>
: <?php 
    if ($product->show_price_from && !$this->config->hide_from_basic_price) {
        print _JSHOP_FROM;
    }
    ?>
 <span><?php 
    print formatprice($product->basic_price_info['basic_price']);
    ?>
 / <?php 
    print $product->basic_price_info['name'];
    ?>
</span></div>
        <?php 
}
?>
        <?php 
if ($this->config->product_list_show_weight && $product->product_weight > 0) {
    ?>
            <div class="productweight"><?php 
    print _JSHOP_WEIGHT;
    ?>
: <span><?php 
Example #28
0
    <td>
      <!-- <span id = "jshop_quantity_products"><?php 
print $cart->count_product;
?>
</span>&nbsp;<?php 
print JText::_('PRODUCTS');
?>
 -->
      <span id = "jshop_quantity_products"><strong><?php 
print JText::_('SUM_TOTAL');
?>
:</strong>&nbsp;</span>&nbsp;
    </td>
    <td>
      <span id = "jshop_summ_product"><?php 
print formatprice($cart->getSum(0, 1));
?>
</span>
    </td>
</tr>
<tr>
    <td colspan="2" align="right" class="goto_cart">
      <a href = "<?php 
print SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1);
?>
"><?php 
if ($params->get('picture_link')) {
    print '<img src="' . JURI::root() . $params->get('picture_link') . '" />';
}
?>
 <?php 
 function step3()
 {
     $checkout = JModelLegacy::getInstance('checkout', 'jshop');
     $checkout->checkStep(3);
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadCheckoutStep3', array());
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     $cart = JModelLegacy::getInstance('cart', 'jshop');
     $cart->load();
     $user = JFactory::getUser();
     if ($user->id) {
         $adv_user = JSFactory::getUserShop();
     } else {
         $adv_user = JSFactory::getUserShopGuest();
     }
     appendPathWay(_JSHOP_CHECKOUT_PAYMENT);
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("checkout-payment");
     if ($seodata->title == "") {
         $seodata->title = _JSHOP_CHECKOUT_PAYMENT;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $checkout_navigator = $this->_showCheckoutNavigation(3);
     if ($jshopConfig->show_cart_all_step_checkout) {
         $small_cart = $this->_showSmallCart(3);
     } else {
         $small_cart = '';
     }
     if ($jshopConfig->without_payment) {
         $checkout->setMaxStep(4);
         $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl));
         return 0;
     }
     $paymentmethod = JTable::getInstance('paymentmethod', 'jshop');
     $shipping_id = $cart->getShippingId();
     $all_payment_methods = $paymentmethod->getAllPaymentMethods(1, $shipping_id);
     $i = 0;
     $paym = array();
     foreach ($all_payment_methods as $pm) {
         $paym[$i] = new stdClass();
         $paymentsysdata = $paymentmethod->getPaymentSystemData($pm->payment_class);
         if ($paymentsysdata->paymentSystem) {
             $paym[$i]->existentcheckform = 1;
             $paym[$i]->payment_system = $paymentsysdata->paymentSystem;
         } else {
             $paym[$i]->existentcheckform = 0;
         }
         $paym[$i]->name = $pm->name;
         $paym[$i]->payment_id = $pm->payment_id;
         $paym[$i]->payment_class = $pm->payment_class;
         $paym[$i]->payment_description = $pm->description;
         $paym[$i]->price_type = $pm->price_type;
         $paym[$i]->image = $pm->image;
         $paym[$i]->price_add_text = '';
         if ($pm->price_type == 2) {
             $paym[$i]->calculeprice = $pm->price;
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . $paym[$i]->calculeprice . '%';
                 } else {
                     $paym[$i]->price_add_text = $paym[$i]->calculeprice . '%';
                 }
             }
         } else {
             $paym[$i]->calculeprice = getPriceCalcParamsTax($pm->price * $jshopConfig->currency_value, $pm->tax_id, $cart->products);
             if ($paym[$i]->calculeprice != 0) {
                 if ($paym[$i]->calculeprice > 0) {
                     $paym[$i]->price_add_text = '+' . formatprice($paym[$i]->calculeprice);
                 } else {
                     $paym[$i]->price_add_text = formatprice($paym[$i]->calculeprice);
                 }
             }
         }
         $s_payment_method_id = $cart->getPaymentId();
         if ($s_payment_method_id == $pm->payment_id) {
             $params = $cart->getPaymentParams();
         } else {
             $params = array();
         }
         $parseString = new parseString($pm->payment_params);
         $pmconfig = $parseString->parseStringToParams();
         if ($paym[$i]->existentcheckform) {
             ob_start();
             $paym[$i]->payment_system->showPaymentForm($params, $pmconfig);
             $paym[$i]->form = ob_get_contents();
             ob_get_clean();
         } else {
             $paym[$i]->form = "";
         }
         $i++;
     }
     $s_payment_method_id = $cart->getPaymentId();
     $active_payment = intval($s_payment_method_id);
     if (!$active_payment) {
         $list_payment_id = array();
         foreach ($paym as $v) {
             $list_payment_id[] = $v->payment_id;
         }
         if (in_array($adv_user->payment_id, $list_payment_id)) {
             $active_payment = $adv_user->payment_id;
         }
     }
     if (!$active_payment) {
         if (isset($paym[0])) {
             $active_payment = $paym[0]->payment_id;
         }
     }
     if ($jshopConfig->hide_payment_step) {
         $first_payment = $paym[0]->payment_class;
         if (!$first_payment) {
             JError::raiseWarning("", _JSHOP_ERROR_PAYMENT);
             return 0;
         }
         $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3save&payment_method=' . $first_payment, 0, 1, $jshopConfig->use_ssl));
         return 0;
     }
     $view_name = "checkout";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("payments");
     $view->assign('payment_methods', $paym);
     $view->assign('active_payment', $active_payment);
     $view->assign('checkout_navigator', $checkout_navigator);
     $view->assign('small_cart', $small_cart);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3save', 0, 0, $jshopConfig->use_ssl));
     $dispatcher->trigger('onBeforeDisplayCheckoutStep3View', array(&$view));
     $view->display();
 }
Example #30
0
            ?>
</td>
         </tr>
         <?php 
        }
        ?>
         <?php 
    }
    ?>
         <tr>
           <td colspan="4" align="right" style="padding-right:15px;"><b><?php 
    print $this->text_total;
    ?>
:</b></td>
           <td class="price"><b><?php 
    print formatprice($this->order->order_total, $order->currency_code);
    print $this->_tmp_ext_total;
    ?>
</b></td>
         </tr>
		 <?php 
    print $this->_tmp_html_after_total;
    ?>
         <tr>
           <td colspan="5">&nbsp;</td>
         </tr>
         <?php 
    if (!$this->client) {
        ?>
         <tr>
           <td colspan="5" class="bg_gray"><?php