Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
index.html000064400000000054151157023530006542 0ustar00<html><body
bgcolor="#FFFFFF"></body></html>shippingmanual_prices.php000064400000035767151157023530011665
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashopShippingmanual_prices extends JPlugin {
function __construct(&$subject, $config) {
parent::__construct($subject, $config);
}
function _getShippings($product, $vendor = null, $edit = true) {
if(empty($product->product_id))
$product_id = 0;
else
$product_id = (int)$product->product_id;
$ids = array();
if(!$edit) {
if (isset($product->variants)) {
foreach($product->variants as $key => $value) {
if (!array_search($value->product_id, $ids))
$ids[] = $value->product_id;
}
}
}
if (!array_search($product_id, $ids))
$ids[] = $product_id;
$extra_filters = '';
if($vendor !== null && $vendor > 1)
$extra_filters = ' AND a.shipping_vendor_id IN (-1, 0, ' .
(int)$vendor . ') ';
$db = JFactory::getDBO();
$query = 'SELECT a.*, c.currency_symbol FROM ' .
hikashop_table('shipping') . ' AS a '.
' INNER JOIN '. hikashop_table('currency').' AS
c ON c.currency_id = a.shipping_currency_id '.
' WHERE (a.shipping_params LIKE \'%' .
hikashop_getEscaped('s:20:"shipping_per_product";s:1:"1"')
. '%\' OR a.shipping_params LIKE \'%' .
hikashop_getEscaped('s:20:"shipping_per_product";i:1')
. '%\') '.
$extra_filters.
'ORDER BY a.shipping_id';
$db->setQuery($query);
$shippings = $db->loadObjectList('shipping_id');
if(empty($shippings))
return $shippings;
if(!count($ids))
return $shippings;
$query = 'SELECT b.* FROM
'.hikashop_table('shipping_price').' AS b '.
' WHERE b.shipping_id IN ('.implode(',',
array_keys($shippings)).')'.
' AND (b.shipping_price_ref_id IS NULL OR (b.shipping_price_ref_id
IN ('.implode(',',$ids). ') AND
b.shipping_price_ref_type = \'product\')) '.
'ORDER BY b.shipping_price_min_quantity';
$db->setQuery($query);
$shippingPrices = $db->loadObjectList();
$ShippingMethodPrices = array();
foreach($shippings as $key => $shipping) {
$no_min_qty_1 = true;
$blocked = false;
$pricesForCurrent = array();
foreach($shippingPrices as $price) {
if($price->shipping_id == $key) {
if(!empty($price->shipping_blocked))
$blocked = true;
if((int)$price->shipping_price_min_quantity<=1)
$no_min_qty_1 = false;
$copy = hikashop_copy($shipping);
foreach(get_object_vars($price) as $k => $v) {
$copy->$k = $v;
}
$pricesForCurrent[] = $copy;
}
}
if(!count($pricesForCurrent)) {
$ShippingMethodPrices[] = $shipping;
} else {
if(!$edit && !$blocked && $no_min_qty_1) {
$copy = hikashop_copy($shipping);
$copy->shipping_price_min_quantity = 1;
$copy->shipping_price_ref_id = $product_id;
array_unshift($pricesForCurrent, $copy);
}
foreach($pricesForCurrent as $current) {
$current->several = count($pricesForCurrent)>1;
$ShippingMethodPrices[] = $current;
}
}
}
$shippings = $ShippingMethodPrices;
if(empty($product->product_vendor_id) && $vendor)
$product->product_vendor_id = $vendor;
$temp_shipping = new stdClass();
foreach($shippings as $key => $shipping) {
$temp_shipping = hikashop_unserialize($shipping->shipping_params);
if(!empty($temp_shipping->shipping_vendor_filter) &&
!empty($temp_shipping->shipping_warehouse_filter)) {
$pos = strpos($temp_shipping->shipping_warehouse_filter,
'v');
if($pos)
$temp_shipping->shipping_warehouse_filter =
substr($temp_shipping->shipping_warehouse_filter, 0, $pos);
}
if(!empty($product->product_warehouse_id) &&
$product->product_warehouse_id != 0) {
if(!empty($temp_shipping->shipping_warehouse_filter) &&
($temp_shipping->shipping_warehouse_filter !=
$product->product_warehouse_id) &&
($temp_shipping->shipping_warehouse_filter != 0))
unset($shippings[$key]);
} else {
if(!empty($temp_shipping->shipping_warehouse_filter) &&
($temp_shipping->shipping_warehouse_filter != 0))
unset($shippings[$key]);
}
if(!empty($product->product_vendor_id) &&
$product->product_vendor_id != 0) {
if(!empty($temp_shipping->shipping_vendor_filter) &&
($temp_shipping->shipping_vendor_filter !=
$product->product_vendor_id) &&
($temp_shipping->shipping_vendor_filter != 0))
unset($shippings[$key]);
} else {
if(!empty($temp_shipping->shipping_vendor_filter) &&
($temp_shipping->shipping_vendor_filter != 0))
unset($shippings[$key]);
}
}
return $shippings;
}
function onProductBlocksDisplay(&$product, &$html) {
if(isset($product->product_parent_id) &&
$product->product_parent_id > 0 &&
isset($product->main->product_id) &&
$product->main->product_id > 0) {
if(isset($product->main->product_warehouse_id) &&
$product->main->product_warehouse_id > 0)
$product->product_warehouse_id =
$product->main->product_warehouse_id;
}
$shippings = $this->_getShippings($product, null, true);
if(empty($shippings))
return;
$currencyHelper = hikashop_get('class.currency');
if(empty($product->product_type))
$product->product_type = 'main';
ob_start();
include
dirname(__FILE__).DS.'shippingprices_views'.DS.'backend_product.php';
$data = ob_get_clean();
$html[] = $data;
}
function onMarketProductBlocksDisplay(&$product, &$html) {
if(!defined('HIKAMARKET_COMPONENT'))
return;
$marketConfig = hikamarket::config();
if(!$marketConfig->get('frontend_edition',0)) return;
if(!hikamarket::acl('product/edit/plugin/shippingprices'))
return;
$vendor_id = hikamarket::loadVendor(false);
if(isset($product->product_parent_id) &&
$product->product_parent_id > 0 &&
isset($product->parent->product_id) &&
$product->parent->product_id > 0) {
if(isset($product->parent->product_warehouse_id) &&
$product->parent->product_warehouse_id > 0)
$product->product_warehouse_id =
$product->parent->product_warehouse_id;
}
$shippings = $this->_getShippings($product, $vendor_id, true);
if(empty($shippings))
return;
$currencyHelper = hikashop_get('class.currency');
if(empty($product->product_id))
$product_id = 0;
else
$product_id = (int)$product->product_id;
ob_start();
include
dirname(__FILE__).DS.'shippingprices_views'.DS.'market_product.php';
$data = ob_get_clean();
$html[] = $data;
return;
}
function onMarketAclPluginListing(&$categories) {
$categories['product'][] = 'shippingprices';
}
function onAfterProductCreate(&$product) {
return $this->onAfterProductUpdate($product, true);
}
function onAfterProductUpdate(&$product, $create = false) {
$request_target = 'shipping_prices';
if(isset($product->product_type) && $product->product_type
== 'variant') {
$request_target = 'variant_shipping_prices';
}
$vendor = null;
if(!hikashop_isClient('administrator')) {
if(!defined('HIKAMARKET_COMPONENT'))
return;
$marketConfig = hikamarket::config();
if(!$marketConfig->get('frontend_edition',0)) return;
if(!hikamarket::acl('product/edit/plugin/shippingprices'))
return;
$vendor = hikamarket::loadVendor(false);
}
$formData = hikaInput::get()->get($request_target, array(),
'array');
if(empty($formData))
return;
if(!empty($formData)) {
if(!hikashop_isClient('administrator')) {
if(isset($formData[$product->product_id]))
$formData = $formData[$product->product_id];
else if(isset($formData[0]) && $create)
$formData = $formData[0];
else
$formData = array();
}
}
if(!empty($product->product_id))
$product_id = $product->product_id;
else
return;
$extra_filters = '';
if($vendor !== null && $vendor > 1)
$extra_filters = ' AND a.shipping_vendor_id IN (-1, 0, ' .
(int)$vendor . ') ';
$db = JFactory::getDBO();
$shipping_params_filter = '(a.shipping_params LIKE '.
$db->Quote('%s:20:"shipping_per_product";i:1;%')
.' OR a.shipping_params LIKE '.
$db->Quote('%s:20:"shipping_per_product";s:1:"1"%')
.')';
$query = 'SELECT b.*, a.*, c.currency_symbol FROM ' .
hikashop_table('shipping') . ' AS a INNER JOIN '.
hikashop_table('shipping_price').' AS b ON a.shipping_id
= b.shipping_id INNER JOIN '.
hikashop_table('currency').' AS c ON c.currency_id =
a.shipping_currency_id '.
'WHERE '.$shipping_params_filter.' AND
b.shipping_price_ref_id = ' . $product_id . ' AND
b.shipping_price_ref_type = \'product\' '.
$extra_filters.
'ORDER BY a.shipping_id, b.shipping_price_min_quantity';
$db->setQuery($query);
$shippings = $db->loadObjectList('shipping_price_id');
$toRemove = array_keys($shippings);
if(!empty($toRemove)) {
$toRemove = array_combine($toRemove, $toRemove);
}
$toInsert = array();
$checks = array();
foreach($formData as &$data) {
if(is_string($data)) {
$data = null;
} else {
if(empty($checks[$data['shipping_id']])) {
$checks[$data['shipping_id']] = array();
}
if(!isset($checks[$data['shipping_id']][$data['qty']]))
{
$checks[$data['shipping_id']][$data['qty']] =
true;
} else {
$data = null;
}
}
unset($data);
}
unset($checks);
foreach($formData as $data) {
if($data == null)
continue;
$shipping_blocked = 0;
if(isset($data['blocked']))
$shipping_blocked = 1;
$shipping = null;
if(!empty($data['id']) &&
isset($shippings[$data['id']]) ) {
if(empty($data['value']) &&
empty($data['fee']) && !$shipping_blocked)
continue;
$shipping = $shippings[$data['id']];
unset($toRemove[$data['id']]);
if(empty($data['qty']) || (int)$data['qty'] <
1)
$data['qty'] = 1;
if( (int)$shipping->shipping_price_min_quantity !=
(int)$data['qty'] || (float)$shipping->shipping_price_value !=
(float)$data['value'] || (float)$shipping->shipping_fee_value
!= (float)$data['fee'] || (int)$shipping->shipping_blocked !=
(int)$shipping_blocked) {
$query = 'UPDATE ' .
hikashop_table('shipping_price') .
' SET shipping_price_min_quantity = ' .
(int)$data['qty'] . ', shipping_price_value = ' .
(float)$data['value'] . ', shipping_fee_value = ' .
(float)$data['fee'] . ', shipping_blocked = ' .
(int)$shipping_blocked .
' WHERE shipping_price_id = ' . $data['id'] .
' AND shipping_price_ref_id = ' . $product->product_id .
' AND shipping_price_ref_type = \'product\'';
$db->setQuery($query);
$db->execute();
}
} else {
if((!empty($data['value']) ||
(!empty($data['fee'])) &&
!empty($data['shipping_id']) ||
(!empty($data['blocked'])) &&
!empty($data['shipping_id'])) ) {
if(empty($data['qty']) || (int)$data['qty'] <
1)
$data['qty'] = 1;
$toInsert[] =
(int)$data['shipping_id'].','.$product->product_id.',\'product\','.(int)$data['qty'].','.(float)$data['value'].','.(float)$data['fee'].','.(int)$shipping_blocked;
}
}
}
if(!empty($toRemove)) {
$db->setQuery('DELETE FROM ' .
hikashop_table('shipping_price') . ' WHERE
shipping_price_ref_id = ' . $product->product_id . ' AND
shipping_price_ref_type = \'product\' AND shipping_price_id IN
('.implode(',',$toRemove).')');
$db->execute();
}
if(!empty($toInsert)) {
$db->setQuery('INSERT IGNORE INTO ' .
hikashop_table('shipping_price') . '
(`shipping_id`,`shipping_price_ref_id`,`shipping_price_ref_type`,`shipping_price_min_quantity`,`shipping_price_value`,`shipping_fee_value`,`shipping_blocked`)
VALUES ('.implode('),(',$toInsert).')');
$db->execute();
}
}
function onHikaShopBeforeDisplayView (&$view) {
if (!isset($view->element->product_id) )
return;
$ctrl = @$view->ctrl;
$task = $view->getLayout();
if($ctrl != "product" || $task != 'show')
return;
$shippings = $this->_getShippings($view->element, null, false);
$shipPrices = @$view->element->prices;
$pluginsClass = hikashop_get('class.plugins');
$plugin =
$pluginsClass->getByName('hikashop','shippingmanual_prices');
if(empty($plugin->params['displayOnFrontend'] ) )
return;
if(!isset($plugin->params['position'] ) )
$plugin->params['position'] = 'rightMiddle';
if(!isset($plugin->params['DisplayMinQtity'] ) )
$plugin->params['DisplayMinQtity'] = 1;
$position = $plugin->params['position'];
$display = $plugin->params['DisplayMinQtity'];
ob_start();
if (!empty ($shippings) && (is_array($shippings) ) ) {
$shipData = array();
foreach ($shippings as $v) {
if ( (isset($v->shipping_blocked)) &&
($v->shipping_blocked == 1) )
$v->shipping_published = 0;
if ($v->shipping_published == 0)
continue;
$arrayKey = $v->shipping_price_id . '_' .
$v->shipping_price_ref_id;
$shipData[$arrayKey] = array();
$shipParams = hikashop_unserialize($v->shipping_params);
$shipData[$arrayKey]['minQtity'] =
$v->shipping_price_min_quantity;
if(!empty($v->several))
$shipData[$arrayKey]['several'] = true;
if ( ($v->shipping_price_min_quantity > 1 ) &&
(isset($v->shipping_price_min_quantity) ) ) {
$total = ($v->shipping_price_min_quantity *
$v->shipping_price_value) + $v->shipping_fee_value +
$v->shipping_price;
} else {
$total = $v->shipping_price_value + $v->shipping_fee_value +
$v->shipping_price;
}
$shipData[$arrayKey]['price'] =
$view->currencyHelper->format($total,$v->shipping_currency_id);
if ($shipParams->shipping_percentage != 0) {
$prdctPrice = 0;
if(!empty($shipPrices)){
foreach ($shipPrices as $v1) {
$prdctPrice = $v1->price_value_with_tax;
if ($v1->price_min_quantity == 0) {
break;
}
}
}
$MainPrice = ($prdctPrice * $shipParams->shipping_percentage) /
100;
$shipData[$arrayKey]['percent'] =
(int)$shipParams->shipping_percentage;
if ( ($v->shipping_price_min_quantity > 1 ) &&
(isset($v->shipping_price_min_quantity) ) ) {
$shipData[$arrayKey]['minQtity'] =
$v->shipping_price_min_quantity;
$total = ($v->shipping_price_min_quantity *
$v->shipping_price_value) + $v->shipping_fee_value +
($v->shipping_price_min_quantity * $MainPrice);
} else {
$shipData[$arrayKey]['minQtity'] = 0;
$total = $v->shipping_price_value + $v->shipping_fee_value +
$MainPrice;
}
$shipData[$arrayKey]['price'] =
$view->currencyHelper->format($view->currencyHelper->round($total),$v->shipping_currency_id);
}
$shipData[$arrayKey]['name'] = $v->shipping_name;
}
if(file_exists(HIKASHOP_MEDIA.'plugins'.DS.'frontend_product.php')){
$file =
HIKASHOP_MEDIA.'plugins'.DS.'frontend_product.php';
}else{
$file =
dirname(__FILE__).DS.'shippingprices_views'.DS.'frontend_product.php';
}
include $file;
}
$data = ob_get_clean();
if(!isset($view->element->extraData))
$view->element->extraData = new stdClass();
if(!isset($view->element->extraData->$position))
$view->element->extraData->$position = array();
array_push($view->element->extraData->$position, $data);
}
}
shippingmanual_prices.xml000064400000006274151157023530011665
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="1.5"
method="upgrade" group="hikashop">
<name>HikaShop Shipping Manual - Price per product
plugin</name>
<creationDate>12 février 2021</creationDate>
<version>4.4.1</version>
<author>Obsidev</author>
<authorEmail>dev@obsidev.com</authorEmail>
<authorUrl>http://www.obsidev.com</authorUrl>
<copyright>Copyright (C) 2012-2021 OBSIDEV SARL - All rights
reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
<description>This plugin allow to configure price per product for
manual shippings</description>
<files>
<filename
plugin="shippingmanual_prices">shippingmanual_prices.php</filename>
</files>
<params addpath="/components/com_hikashop/params">
<param name="displayOnFrontend" type="radio"
default="0"
label="HIKA_DISPLAY_SHIPPING_ON_PRODUCT_PAGE"
description="HIKA_DISPLAY_SHIPPING_PRICE_PER_PRODUCT_ON_PRODUCT_PAGE">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
<param name="position" type="list"
default="rightMiddle" label="HIKA_FRONTEND_POSITION"
description="SHIP_POSITION">
<option value="topBegin">TOP_BEGIN</option>
<option value="topEnd">TOP_END</option>
<option value="leftBegin">LEFT_BEGIN</option>
<option value="leftEnd">LEFT_END</option>
<option value="rightBegin">RIGHT_BEGIN</option>
<option value="rightMiddle">RIGHT_MIDDLE</option>
<option value="rightEnd">RIGHT_END</option>
<option value="bottomBegin">BOTTOM_BEGIN</option>
<option
value="bottomMiddle">BOTTOM_MIDDLE</option>
<option value="bottomEnd">BOTTOM_END</option>
</param>
<param name="DisplayMinQtity" type="radio"
default="0"
label="HIKA_DISPLAY_PER_PRODUCT_SHIPPING">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</param>
</params>
<config>
<fields name="params"
addfieldpath="/components/com_hikashop/fields">
<fieldset name="basic">
<field name="displayOnFrontend" type="radio"
default="0"
label="HIKA_DISPLAY_SHIPPING_ON_PRODUCT_PAGE"
description="HIKA_DISPLAY_SHIPPING_PRICE_PER_PRODUCT_ON_PRODUCT_PAGE">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
<field name="position" type="list"
default="rightMiddle" label="HIKA_FRONTEND_POSITION"
description="SHIP_POSITION">
<option value="topBegin">TOP_BEGIN</option>
<option value="topEnd">TOP_END</option>
<option value="leftBegin">LEFT_BEGIN</option>
<option value="leftEnd">LEFT_END</option>
<option value="rightBegin">RIGHT_BEGIN</option>
<option
value="rightMiddle">RIGHT_MIDDLE</option>
<option value="rightEnd">RIGHT_END</option>
<option
value="bottomBegin">BOTTOM_BEGIN</option>
<option
value="bottomMiddle">BOTTOM_MIDDLE</option>
<option value="bottomEnd">BOTTOM_END</option>
</field>
<field name="DisplayMinQtity" type="radio"
default="0" label="HIKA_DISPLAY_PER_PRODUCT_SHIPPING"
class="btn-group btn-group-yesno">
<option value="0">HIKASHOP_NO</option>
<option value="1">HIKASHOP_YES</option>
</field>
</fieldset>
</fields>
</config>
</extension>
shippingprices_views/backend_product.php000064400000023153151157023530014656
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><div class="hkc-xl-4 hkc-lg-6 hikashop_product_block
hikashop_product_edit_shippingfees"><div>
<div class="hikashop_product_part_title
hikashop_product_edit_shippingfees_title"><?php echo
JText::_('SHIPPING_PRICES');?></div>
<table class="adminlist table table-striped
hikashop_product_prices_table" width="100%">
<thead>
<tr>
<th class="title"><?php echo
JText::_('HIKA_NAME'); ?></th>
<th class="title" width="6%"><?php
echo hikashop_tooltip(JText::_('MINIMUM_QUANTITY'),
'', '', JText::_('MIN_QTY'), '',
0);
?></th>
<th class="title"><?php echo
JText::_('PRICE'); ?></th>
<th class="title"><?php echo
JText::_('FEE'); ?></th>
<th class="title"><?php echo
JText::_('SHIPPING_BLOCKED'); ?></th>
<th class="title"><?php echo
JText::_('ACTIONS'); ?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
$type = '';
if ($product->product_type != 'main')
$type = 'variant_';
$previous_shipping_id = -1;
foreach($shippings as &$shipping) {
$shipping->shipping_params =
hikashop_unserialize($shipping->shipping_params);
$shipping_data = $shipping->shipping_name . ' - ' .
$currencyHelper->displayPrices(array($shipping),
'shipping_price', 'shipping_currency_id');
if(isset($shipping->shipping_params->shipping_percentage) &&
bccomp($shipping->shipping_params->shipping_percentage,0,3)) {
$shipping_data .= '
+'.$shipping->shipping_params->shipping_percentage.'%';
}
$rest = array();
if(!empty($shipping->shipping_params->shipping_min_volume)){ $rest[]
=
JText::_('SHIPPING_MIN_VOLUME').':'.$shipping->shipping_params->shipping_min_volume.$shipping->shipping_params->shipping_size_unit;
}
if(!empty($shipping->shipping_params->shipping_max_volume)){ $rest[]
=
JText::_('SHIPPING_MAX_VOLUME').':'.$shipping->shipping_params->shipping_max_volume.$shipping->shipping_params->shipping_size_unit;
}
if(!empty($shipping->shipping_params->shipping_min_weight)){ $rest[]
=
JText::_('SHIPPING_MIN_WEIGHT').':'.$shipping->shipping_params->shipping_min_weight.$shipping->shipping_params->shipping_weight_unit;
}
if(!empty($shipping->shipping_params->shipping_max_weight)){ $rest[]
=
JText::_('SHIPPING_MAX_WEIGHT').':'.$shipping->shipping_params->shipping_max_weight.$shipping->shipping_params->shipping_weight_unit;
}
if(isset($shipping->shipping_params->shipping_min_price) &&
bccomp($shipping->shipping_params->shipping_min_price,0,5)){
$shipping->shipping_min_price=$shipping->shipping_params->shipping_min_price;
$rest[] =
JText::_('SHIPPING_MIN_PRICE').':'.$currencyHelper->displayPrices(array($shipping),'shipping_min_price','shipping_currency_id');
}
if(isset($shipping->shipping_params->shipping_max_price) &&
bccomp($shipping->shipping_params->shipping_max_price,0,5)){
$shipping->shipping_max_price=$shipping->shipping_params->shipping_max_price;
$rest[] =
JText::_('SHIPPING_MAX_PRICE').':'.$currencyHelper->displayPrices(array($shipping),'shipping_max_price','shipping_currency_id');
}
if(!empty($shipping->shipping_params->shipping_zip_prefix)){
$rest[]=JText::_('SHIPPING_PREFIX').':'.$shipping->shipping_params->shipping_zip_prefix;
}
if(!empty($shipping->shipping_params->shipping_min_zip)){
$rest[]=JText::_('SHIPPING_MIN_ZIP').':'.$shipping->shipping_params->shipping_min_zip;
}
if(!empty($shipping->shipping_params->shipping_max_zip)){
$rest[]=JText::_('SHIPPING_MAX_ZIP').':'.$shipping->shipping_params->shipping_max_zip;
}
if(!empty($shipping->shipping_params->shipping_zip_suffix)){
$rest[]=JText::_('SHIPPING_SUFFIX').':'.$shipping->shipping_params->shipping_zip_suffix;
}
if(!empty($shipping->zone_name_english)){
$rest[]=JText::_('ZONE').':'.$shipping->zone_name_english;
}
if(!empty($rest)) {
$shipping_data .= '<div
style="margin-left:10px">'.implode('<br/>',
$rest).'</div>';
}
if($previous_shipping_id != $shipping->shipping_id) {
echo "\r\n".'<tr
class="hikashop_shipping_price_category"><td
colspan="5">'.$shipping_data.'</td><td
class="hk_center">'.
'<a href="#"
title="'.JText::_('ADD').'"
onclick="return
hikashop_addline_shippingprice(this,'.$shipping->shipping_id.',\''.str_replace(array('"',"'"),array('"','\\\''),$shipping->shipping_name).'\',\''.$shipping->currency_symbol.'\',\''.$type.'\');"><i
class="fa fa-plus"></i></a>'.
'</td></tr>';
}
$previous_shipping_id = $shipping->shipping_id;
if(!empty($shipping->shipping_price_value) ||
!empty($shipping->shipping_fee_value)) {
if($shipping->shipping_price_min_quantity < 1)
$shipping->shipping_price_min_quantity = 1;
if(isset($shipping->shipping_blocked) &&
$shipping->shipping_blocked) {
$blocked_checked = 'checked="checked"';
$attribute = 'readonly="readonly"';
$shipping->shipping_price_value = 0;
$shipping->shipping_fee_value = 0;
}else{
$blocked_checked = '';
$attribute = '';
}
echo '<tr><td>'.
'<input type="hidden"
name="'.$type.'shipping_prices['.$i.'][id]"
value="'.$shipping->shipping_price_id.'"/>'.
'<input type="hidden"
name="'.$type.'shipping_prices['.$i.'][shipping_id]"
value="'.$shipping->shipping_id.'"/>'.
'</td><td><input type="text"
name="'.$type.'shipping_prices['.$i.'][qty]"
value="'.$shipping->shipping_price_min_quantity.'"
size="3"/></td>'.
'<td style="text-align:center"><input
type="text"
id="'.$type.'shipping_prices_value_'.$i.'"
'.$attribute.'
name="'.$type.'shipping_prices['.$i.'][value]"
value="'.$shipping->shipping_price_value.'"
size="7"/>
'.$shipping->currency_symbol.'</td>'.
'<td style="text-align:center"><input
type="text"
id="'.$type.'shipping_prices_fee_'.$i.'"
'.$attribute.'
name="'.$type.'shipping_prices['.$i.'][fee]"
value="'.$shipping->shipping_fee_value.'"
size="7"/>
'.$shipping->currency_symbol.'</td>'.
'<td><input type="checkbox"
name="'.$type.'shipping_prices['.$i.'][blocked]"
onchange="hikashop_shippingprice_blocked_change('.$i.',
this, \''.$type.'\')"
'.$blocked_checked.'/></td>'.
'<td class="hk_center">'.
'<a href="#" onclick="return
hikashop_remline_shippingprice(this);"
title="'.JText::_('HIKA_DELETE').'"><i
class="fas fa-trash"></i></a>'.
'</td></tr>';
}
$i++;
unset($shipping);
}
?>
<tr id="hikashop_shipping_price_tpl_line_<?php echo
$type;?>" style="display:none">
<td><input type="hidden" name="{field_id}"
value="{shipping_id}"/></td>
<td><input type="text" name="{field_qty}"
value="" size="3"/></td>
<td style="text-align:center"><input
id="<?php echo $type; ?>shipping_prices_value_{cpt}"
type="text" name="{field_value}" value=""
size="7"/> {currency}</td>
<td style="text-align:center"><input
id="<?php echo $type; ?>shipping_prices_fee_{cpt}"
type="text" name="{field_fee}" value=""
size="7"/> {currency}</td>
<td><input type="checkbox"
name="{field_blocked}"
onchange="hikashop_shippingprice_blocked_change({cpt}, this,
'<?php echo $type; ?>')"/></td>
<td class="hk_center"><a href="#"
onclick="return hikashop_remline_shippingprice(this);"
title="<?php echo JText::_('HIKA_DELETE');
?>"><i class="fas
fa-trash"></i></a></td>
</tr>
</tbody>
</table>
<input type="hidden" name="shipping_prices[init]"
value=""/>
<script type="text/javascript">
var hikashop_shippingprice_cpt = <?php echo $i; ?>;
function hikashop_addline_shippingprice(el,id,name,currency,product_type)
{
var d = document, tplLine =
d.getElementById("hikashop_shipping_price_tpl_line_" +
product_type),
tableUser = tplLine.parentNode,
htmlblocks = {
cpt: hikashop_shippingprice_cpt,
field_id:
product_type+"shipping_prices["+hikashop_shippingprice_cpt+"][shipping_id]",
field_qty:
product_type+"shipping_prices["+hikashop_shippingprice_cpt+"][qty]",
field_fee:
product_type+"shipping_prices["+hikashop_shippingprice_cpt+"][fee]",
field_value:
product_type+"shipping_prices["+hikashop_shippingprice_cpt+"][value]",
field_blocked:
product_type+"shipping_prices["+hikashop_shippingprice_cpt+"][blocked]",
shipping_id: id,
name: name,
currency: currency
};
if(!tplLine) return;
var trLine = tplLine.cloneNode(true);
trLine.id = "";
while(el != null && el.tagName.toLowerCase() != "tr") {
el = el.parentNode; }
if(el == null || !el.nextSibling) {
tableUser.appendChild(trLine);
} else {
while(el.nextSibling && el.nextSibling.tagName &&
el.nextSibling.tagName.toLowerCase() == "tr" &&
el.nextSibling.class != "hikashop_shipping_price_category") { el
= el.nextSibling; }
tableUser.insertBefore(trLine, el.nextSibling);
}
trLine.style.display = "";
for (var i = tplLine.cells.length - 1; i >= 0; i--) {
for(var k in htmlblocks) {
if(trLine.cells[i])
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new
RegExp("{"+k+"}","g"), htmlblocks[k]);
}
}
hikashop_shippingprice_cpt++;
return false;
}
function hikashop_remline_shippingprice(el) {
while(el != null && el.tagName.toLowerCase() != "tr") {
el = el.parentNode; }
if(!el) return;
var table = el.parentNode;
table.removeChild(el);
return false;
}
function hikashop_shippingprice_blocked_change(id, el, product_type) {
var d = document,
elValue =
d.getElementById(product_type+"shipping_prices_value_"+id),
elFee =
d.getElementById(product_type+"shipping_prices_fee_"+id);
if(!elValue || !elFee) {
return false;
}
if(el.checked) {
elValue.setAttribute("readonly", "readonly");
elFee.setAttribute("readonly", "readonly");
} else {
elValue.removeAttribute("readonly", "readonly");
elFee.removeAttribute("readonly", "readonly");
}
}
</script>
</div></div>
shippingprices_views/frontend_product.php000064400000002626151157023530015110
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_shippingmanual_prices">
<?php
$title = (count($shippings) > 1) ?
JText::_('SEVERAL_SHIPPING_METHOD_PER_PRODUCT') :
JText::_('ONE_SHIPPING_METHOD_PER_PRODUCT');
?>
<div class="hikashop_shipping_manual_price"><?php echo
$title; ?></div><br/>
<div class="shipping_price_per_prdct_method">
<?php
foreach($shipData as $key => $value) {
if ( !empty($shipData[$key]['several']) && $display == 1
) {
?>
<div id="shipping_per_product_<?php echo $key;
?>">
<span class="shipping_per_product_<?php echo $key;
?>">
<?php echo
JText::sprintf('HIKA_FOR_AN_ORDER_OF',$shipData[$key]['name'],$shipData[$key]['minQtity'],$view->element->product_name);?>
<span class="price_per_product"><?php echo
$shipData[$key]['price']; ?></span>
</span>
</div>
<?php
} elseif ($shipData[$key]['minQtity'] <= 1) {
?>
<div id="shipping_per_product_<?php echo $key;
?>">
<span class="shipping_per_product_<?php echo $key;
?>"> <?php echo $shipData[$key]['name'] . ' :
';?>
<span class="price_per_product"><?php echo
$shipData[$key]['price']; ?></span>
</span>
</div>
<?php
}
}
?>
</div>
</div><br/>
shippingprices_views/index.html000064400000000054151157023530013006
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>shippingprices_views/market_product.php000064400000023444151157023530014555
0ustar00<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><div class="hikamarket_section_container
hikamarket_section_product_plugin_shippingprices">
<h3 data-section-toggle="product_plugin_shippingprices"
class="hikamarket_section_toggle"><?php echo
JText::_('SHIPPING_PRICES'); ?></h3>
<div
id="hikamarket_section_product_plugin_shippingprices">
<table class="adminlist table table-striped"
style="cell-spacing:1px;width:100%;">
<thead>
<tr>
<th class="title"><?php echo
JText::_('HIKA_NAME'); ?></th>
<th class="title" width="10px"><?php echo
JText::_('MINIMUM_QUANTITY'); ?></th>
<th class="title"><?php echo
JText::_('PRICE'); ?></th>
<th class="title"><?php echo
JText::_('FEE'); ?></th>
<th class="title"><?php echo
JText::_('SHIPPING_BLOCKED'); ?></th>
<th class="title"><?php echo
JText::_('ACTIONS'); ?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
$previous_shipping_id = -1;
foreach($shippings as &$shipping) {
$shipping->shipping_params =
hikashop_unserialize($shipping->shipping_params);
$shipping_data = $shipping->shipping_name . ' - ' .
$currencyHelper->displayPrices(array($shipping),
'shipping_price', 'shipping_currency_id');
if(isset($shipping->shipping_params->shipping_percentage) &&
bccomp($shipping->shipping_params->shipping_percentage,0,3)) {
$shipping_data .= '
+'.$shipping->shipping_params->shipping_percentage.'%';
}
$rest = array();
if(!empty($shipping->shipping_params->shipping_min_volume)){ $rest[]
=
JText::_('SHIPPING_MIN_VOLUME').':'.$shipping->shipping_params->shipping_min_volume.$shipping->shipping_params->shipping_size_unit;
}
if(!empty($shipping->shipping_params->shipping_max_volume)){ $rest[]
=
JText::_('SHIPPING_MAX_VOLUME').':'.$shipping->shipping_params->shipping_max_volume.$shipping->shipping_params->shipping_size_unit;
}
if(!empty($shipping->shipping_params->shipping_min_weight)){ $rest[]
=
JText::_('SHIPPING_MIN_WEIGHT').':'.$shipping->shipping_params->shipping_min_weight.$shipping->shipping_params->shipping_weight_unit;
}
if(!empty($shipping->shipping_params->shipping_max_weight)){ $rest[]
=
JText::_('SHIPPING_MAX_WEIGHT').':'.$shipping->shipping_params->shipping_max_weight.$shipping->shipping_params->shipping_weight_unit;
}
if(isset($shipping->shipping_params->shipping_min_price) &&
bccomp($shipping->shipping_params->shipping_min_price,0,5)){
$shipping->shipping_min_price=$shipping->shipping_params->shipping_min_price;
$rest[] =
JText::_('SHIPPING_MIN_PRICE').':'.$currencyHelper->displayPrices(array($shipping),'shipping_min_price','shipping_currency_id');
}
if(isset($shipping->shipping_params->shipping_max_price) &&
bccomp($shipping->shipping_params->shipping_max_price,0,5)){
$shipping->shipping_max_price=$shipping->shipping_params->shipping_max_price;
$rest[] =
JText::_('SHIPPING_MAX_PRICE').':'.$currencyHelper->displayPrices(array($shipping),'shipping_max_price','shipping_currency_id');
}
if(!empty($shipping->shipping_params->shipping_zip_prefix)){
$rest[]=JText::_('SHIPPING_PREFIX').':'.$shipping->shipping_params->shipping_zip_prefix;
}
if(!empty($shipping->shipping_params->shipping_min_zip)){
$rest[]=JText::_('SHIPPING_MIN_ZIP').':'.$shipping->shipping_params->shipping_min_zip;
}
if(!empty($shipping->shipping_params->shipping_max_zip)){
$rest[]=JText::_('SHIPPING_MAX_ZIP').':'.$shipping->shipping_params->shipping_max_zip;
}
if(!empty($shipping->shipping_params->shipping_zip_suffix)){
$rest[]=JText::_('SHIPPING_SUFFIX').':'.$shipping->shipping_params->shipping_zip_suffix;
}
if(!empty($shipping->zone_name_english)){
$rest[]=JText::_('ZONE').':'.$shipping->zone_name_english;
}
if(!empty($rest)) {
$shipping_data .= '<div
style="margin-left:10px">'.implode('<br/>',
$rest).'</div>';
}
if($previous_shipping_id != $shipping->shipping_id) {
echo "\r\n".'<tr
class="hikashop_shipping_price_category"><td
colspan="5">'.$shipping_data.'</td><td
class="hk_center">'.
'<a href="#"
title="'.JText::_('ADD').'"
onclick="return
hikashop_shippingprice.addLine('.$product_id.',this,'.$shipping->shipping_id.',\''.str_replace(array('"',"'"),array('"','\\\''),$shipping->shipping_name).'\',\''.$shipping->currency_symbol.'\');"><i
class="fa fa-plus"></i></a>'.
'</td></tr>';
}
$previous_shipping_id = $shipping->shipping_id;
if(!empty($shipping->shipping_price_value) ||
!empty($shipping->shipping_fee_value)) {
if($shipping->shipping_price_min_quantity < 1)
$shipping->shipping_price_min_quantity = 1;
if(isset($shipping->shipping_blocked) &&
$shipping->shipping_blocked) {
$blocked_checked = 'checked="checked"';
$attribute = 'readonly="readonly"';
$shipping->shipping_price_value = 0;
$shipping->shipping_fee_value = 0;
}else{
$blocked_checked = '';
$attribute = '';
}
echo '<tr><td>'.
'<input type="hidden"
name="shipping_prices['.$product_id.']['.$i.'][id]"
value="'.$shipping->shipping_price_id.'"/>'.
'<input type="hidden"
name="shipping_prices['.$product_id.']['.$i.'][shipping_id]"
value="'.$shipping->shipping_id.'"/>'.
'</td><td><input style="width:auto;"
type="text"
name="shipping_prices['.$product_id.']['.$i.'][qty]"
value="'.$shipping->shipping_price_min_quantity.'"
size="3"/></td>'.
'<td style="text-align:center"><input
style="width:auto;" type="text"
id="shipping_prices_value_'.$product_id.'_'.$i.'"
'.$attribute.'
name="shipping_prices['.$product_id.']['.$i.'][value]"
value="'.$shipping->shipping_price_value.'"
size="7"/>
'.$shipping->currency_symbol.'</td>'.
'<td style="text-align:center"><input
style="width:auto;" type="text"
id="shipping_prices_fee_'.$product_id.'_'.$i.'"
'.$attribute.'
name="shipping_prices['.$product_id.']['.$i.'][fee]"
value="'.$shipping->shipping_fee_value.'"
size="7"/>
'.$shipping->currency_symbol.'</td>'.
'<td><input type="checkbox"
name="shipping_prices['.$product_id.']['.$i.'][blocked]"
onchange="hikashop_shippingprice.block('.$product_id.','.$i.',
this);" '.$blocked_checked.'/></td>'.
'<td class="hk_center">'.
'<a href="#" onclick="return
hikashop_shippingprice.remLine(this);"
title="'.JText::_('HIKA_DELETE').'"><i
class="fas fa-trash"></i></a>'.
'</td></tr>';
}
$i++;
unset($shipping);
}
?>
<tr id="hikashop_shipping_price_tpl_line_<?php echo
$product_id; ?>" style="display:none">
<td><input type="hidden" name="{field_id}"
value="{shipping_id}"/></td>
<td><input style="width:auto;" type="text"
name="{field_qty}" value=""
size="3"/></td>
<td style="text-align:center"><input
style="width:auto;" id="shipping_prices_value_<?php echo
$product_id; ?>_{cpt}" type="text"
name="{field_value}" value="" size="7"/>
{currency}</td>
<td style="text-align:center"><input
style="width:auto;" id="shipping_prices_fee_<?php echo
$product_id; ?>_{cpt}" type="text"
name="{field_fee}" value="" size="7"/>
{currency}</td>
<td><input type="checkbox"
name="{field_blocked}"
onchange="hikashop_shippingprice.block(<?php echo $product_id;
?>,{cpt}, this);" /></td>
<td class="hk_center"><a href="#"
onclick="return hikashop_shippingprice.remLine(this);"
title="<?php echo JText::_('HIKA_DELETE');
?>"><i class="fas
fa-trash"></i></a></td>
</tr>
</tbody>
</table>
<input type="hidden" name="shipping_prices[init]"
value=""/>
<script type="text/javascript">
if(hikashop_shippingprice === undefined) {
var hikashop_shippingprice = {
cpt: {
<?php echo $product_id; ?>: <?php echo $i; ?>
},
addLine: function(pid,el,id,name,currency) {
if(!this.cpt[pid])
this.cpt[pid] = 0;
var d = document, tplLine =
d.getElementById("hikashop_shipping_price_tpl_line_"+pid),
tableUser = tplLine.parentNode,
htmlblocks = {
cpt: this.cpt[pid],
field_id:
"shipping_prices["+pid+"]["+this.cpt[pid]+"][shipping_id]",
field_qty:
"shipping_prices["+pid+"]["+this.cpt[pid]+"][qty]",
field_fee:
"shipping_prices["+pid+"]["+this.cpt[pid]+"][fee]",
field_value:
"shipping_prices["+pid+"]["+this.cpt[pid]+"][value]",
field_blocked:
"shipping_prices["+pid+"]["+this.cpt[pid]+"][blocked]",
shipping_id: id,
name: name,
currency: currency
};
if(!tplLine) return;
var trLine = tplLine.cloneNode(true);
trLine.id = "";
while(el != null && el.tagName.toLowerCase() != "tr") {
el = el.parentNode; }
if(el == null || !el.nextSibling) {
tableUser.appendChild(trLine);
} else {
while(el.nextSibling && el.nextSibling.tagName &&
el.nextSibling.tagName.toLowerCase() == "tr" &&
el.nextSibling.class != "hikashop_shipping_price_category") { el
= el.nextSibling; }
tableUser.insertBefore(trLine, el.nextSibling);
}
trLine.style.display = "";
for (var i = tplLine.cells.length - 1; i >= 0; i--) {
for(var k in htmlblocks) {
if(trLine.cells[i])
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new
RegExp("{"+k+"}","g"), htmlblocks[k]);
}
}
this.cpt[pid]++;
return false;
},
remLine: function(el) {
while(el != null && el.tagName.toLowerCase() != "tr") {
el = el.parentNode; }
if(!el) return;
var table = el.parentNode;
table.removeChild(el);
return false;
},
block: function(pid,id,el) {
var d = document,
elValue =
d.getElementById("shipping_prices_value_"+pid+"_"+id),
elFee =
d.getElementById("shipping_prices_fee_"+pid+"_"+id);
if(!elValue || !elFee)
return false;
if(el.checked) {
elValue.setAttribute("readonly", "readonly");
elFee.setAttribute("readonly", "readonly");
} else {
elValue.removeAttribute("readonly", "readonly");
elFee.removeAttribute("readonly", "readonly");
}
return false;
}
};
} else {
hikashop_shippingprice.cpt[<?php echo $product_id; ?>] = <?php
echo $i; ?>;
}
</script>
</div>
</div>