Skip to content

Commit

Permalink
3.2.2
Browse files Browse the repository at this point in the history
3.2.2
  • Loading branch information
PhocaCz committed May 31, 2019
1 parent e5de796 commit 28c1e57
Show file tree
Hide file tree
Showing 31 changed files with 205 additions and 108 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Phoca Cart is e-commerce extension - powerful shopping cart for Joomla! CMS. Pho

## Version

3.2.1
3.2.2



Expand Down
5 changes: 5 additions & 0 deletions admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@
<option value="3">COM_PHOCACART_YES_CATEGORY_ALL_VIEWS</option>
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="stock_status_display_count" default="0" type="radio" class="btn-group btn-group-yesno" label="COM_PHOCACART_FIELD_DISPLAY_STOCK_AMOUNT_IN_STOCK_STATUS_LABEL" description="COM_PHOCACART_FIELD_DISPLAY_STOCK_AMOUNT_IN_STOCK_STATUS_DESC">
<option value="1">COM_PHOCACART_YES</option>
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="hide_products_out_of_stock" default="0" type="radio" class="btn-group btn-group-yesno" label="COM_PHOCACART_FIELD_HIDE_PRODUCTS_OUT_OF_STOCK_LABEL"
description="COM_PHOCACART_FIELD_HIDE_PRODUCTS_OUT_OF_STOCK_DESC">
Expand Down
6 changes: 6 additions & 0 deletions admin/help/en-GB/screen.phocacart.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ <h1>Phoca Cart</h1>
<a href="https://www.phoca.cz/forum/" target="_blank">Phoca Cart Forum</a><br />
</p>
<p>&nbsp;</p>
<h2>Demo</h2>
<p>
<a href="https://www.phoca.cz/phocacartdemo/" target="_blank">Phoca Cart Demo</a><br />
<a href="https://www.phoca.cz/phocacartdemo/premiere/" target="_blank">Phoca Cart - Phoca Premiere Template Demo</a><br />
<a href="https://www.phoca.cz/stockphoto/" target="_blank">Phoca Cart Demo - Phoca Stock Photo</a><br />
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
Expand Down
6 changes: 6 additions & 0 deletions admin/help/screen.phocacart.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ <h1>Phoca Cart</h1>
<a href="https://www.phoca.cz/forum/" target="_blank">Phoca Cart Forum</a><br />
</p>
<p>&nbsp;</p>
<h2>Demo</h2>
<p>
<a href="https://www.phoca.cz/phocacartdemo/" target="_blank">Phoca Cart Demo</a><br />
<a href="https://www.phoca.cz/phocacartdemo/premiere/" target="_blank">Phoca Cart - Phoca Premiere Template Demo</a><br />
<a href="https://www.phoca.cz/stockphoto/" target="_blank">Phoca Cart Demo - Phoca Stock Photo</a><br />
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
Expand Down
22 changes: 13 additions & 9 deletions admin/install/sql/mysql/install.utf8.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_categories` (
`published` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

`created_by` int(11) NOT NULL DEFAULT '0',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(11) NOT NULL DEFAULT '0',
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

`ordering` int(11) NOT NULL DEFAULT '0',
`access` int(11) unsigned NOT NULL DEFAULT '0',
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
Expand Down Expand Up @@ -113,12 +113,12 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_products` (
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ordering` int(11) NOT NULL DEFAULT '0',
`access` int(11) unsigned NOT NULL DEFAULT '0',

`created_by` int(11) NOT NULL DEFAULT '0',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` int(11) NOT NULL DEFAULT '0',
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`hits` int(11) NOT NULL DEFAULT '0',
`sales` int(11) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -301,12 +301,12 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_specifications` (
`alias` varchar(255) NOT NULL DEFAULT '',
`value` text,
`alias_value` varchar(255) NOT NULL DEFAULT '',

`image` varchar(255) NOT NULL DEFAULT '',
`image_medium` varchar(255) NOT NULL DEFAULT '',
`image_small` varchar(255) NOT NULL DEFAULT '',
`color` varchar(50) NOT NULL DEFAULT '',

`published` tinyint(1) NOT NULL DEFAULT '0',
`checked_out` int(11) unsigned NOT NULL DEFAULT '0',
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
Expand Down Expand Up @@ -449,6 +449,10 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_shipping_methods` (
`maximal_height` DECIMAL( 15, 4 ) NOT NULL DEFAULT '0',
`maximal_length` DECIMAL( 15, 4 ) NOT NULL DEFAULT '0',

`minimal_width` DECIMAL( 15, 4 ) NOT NULL DEFAULT '0',
`minimal_height` DECIMAL( 15, 4 ) NOT NULL DEFAULT '0',
`minimal_length` DECIMAL( 15, 4 ) NOT NULL DEFAULT '0',

`active_quantity` tinyint(1) NOT NULL DEFAULT '0',
`minimal_quantity` int(11) NOT NULL DEFAULT '0',
`maximal_quantity` int(11) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -1014,10 +1018,10 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_orders` (
`invoice_spec_top_desc` text,
`invoice_spec_middle_desc` text,
`invoice_spec_bottom_desc` text,

`oidn_spec_billing_desc` text,
`oidn_spec_shipping_desc` text,


`privacy` tinyint(1) NOT NULL default '0',

Expand All @@ -1028,7 +1032,7 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_orders` (
`date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`params` text,

`user_lang` char(7) NOT NULL DEFAULT '',
`default_lang` char(7) NOT NULL DEFAULT '',
`language` char(7) NOT NULL DEFAULT '',
Expand Down
11 changes: 11 additions & 0 deletions admin/language/en-GB/en-GB.com_phocacart.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ COM_PHOCACART_ORDER_PAYMENT_PROCESSED_DOWNLOADABLE_ITEMS_ADDITIONAL_INFO=""
COM_PHOCACART_ORDER_PAYMENT_CANCELED_ADDITIONAL_INFO=""


;[3.2.2]
COM_PHOCACART_FIELD_MINIMAL_WIDTH_LABEL="Minimal Width"
COM_PHOCACART_FIELD_MINIMAL_WIDTH_DESC="Set minimal width. When any of the ordered products does not exceed the minimal width, then the size rule is invalid"
COM_PHOCACART_FIELD_MINIMAL_HEIGHT_LABEL="Minimal Height"
COM_PHOCACART_FIELD_MINIMAL_HEIGHT_DESC="Set minimal height. When any of the ordered products does not exceed the minimal height, then the size rule is invalid"
COM_PHOCACART_FIELD_MINIMAL_LENGTH_LABEL="Minimal Length"
COM_PHOCACART_FIELD_MINIMAL_LENGTH_DESC="Set minimal length. When any of the ordered products does not exceed the minimal length, then the size rule is invalid"
COM_PHOCACART_YOU_ARE_PREVIEWING_LIVE_PAGE="Be aware, you're previewing a live page"
COM_PHOCACART_PRODUCT_PREVIEW="Product Preview"
COM_PHOCACART_FIELD_DISPLAY_STOCK_AMOUNT_IN_STOCK_STATUS_LABEL="Display Stock Amount In Stock Status"
COM_PHOCACART_FIELD_DISPLAY_STOCK_AMOUNT_IN_STOCK_STATUS_DESC="Set if stock amount will be displayed in stock status output"
;[3.2.0]
COM_PHOCACART_NO_ITEMS_FOUND="No items found"
COM_PHOCACART_REMOVE_PRODUCT_FROM_CART="Remove product from cart"
Expand Down
5 changes: 4 additions & 1 deletion admin/libraries/phocacart/attribute/attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,12 @@ public static function storeAttributesById($productId, $attributesArray, $new =
// SELECT - only one default value
$defaultValue = 0;
$dVR = 1;
} else if ($dTV == '' && (int)$dI > 0) {
} else if ($dTV === '' && (int)$dI > 0) {

// TEXT - no default value
$defaultValue = 0;
$dVR = 1;

}
}

Expand Down Expand Up @@ -439,6 +441,7 @@ public static function storeAttributesById($productId, $attributesArray, $new =

}


// One or more default values removed
if ($dVR == 1) {
$msg = JText::_('COM_PHOCACART_ATTRIBUTE'). ': '. $v['title'] . "<br />";
Expand Down
12 changes: 6 additions & 6 deletions admin/libraries/phocacart/cart/calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function calculateBasicProducts(&$fullItems, &$fullItemsGroup, &$total, &
$total['dnetto'] = 0;
$total['quantity'] = 0;

$total['max_length'] = 0;
$total['max_width'] = 0;
$total['max_height'] = 0;
$total['length'] = 0;
$total['width'] = 0;
$total['height'] = 0;

$total['points_needed'] = 0;
$total['points_received'] = 0;
Expand Down Expand Up @@ -245,9 +245,9 @@ public function calculateBasicProducts(&$fullItems, &$fullItemsGroup, &$total, &
$total['weight'] += ($fullItems[$k]['weight'] * $fQ);
$total['volume'] += ($fullItems[$k]['volume'] * $fQ);

$total['max_length'] = $itemD->length > $total['max_length'] ? $itemD->length : $total['max_length'];
$total['max_width'] = $itemD->width > $total['max_width'] ? $itemD->width : $total['max_width'];
$total['max_height'] = $itemD->height > $total['max_height'] ? $itemD->height : $total['max_height'];
$total['length'] = $itemD->length > $total['length'] ? $itemD->length : $total['length'];
$total['width'] = $itemD->width > $total['width'] ? $itemD->width : $total['width'];
$total['height'] = $itemD->height > $total['height'] ? $itemD->height : $total['height'];

$total['points_needed'] += ($fullItems[$k]['points_needed'] * $fQ);
$total['points_received'] += ($fullItems[$k]['points_received'] * $fQ);
Expand Down
4 changes: 2 additions & 2 deletions admin/libraries/phocacart/order/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function saveOrderMain($data) {
// - check if this method even exists
// - and check if the selected method meets every criteria and rules to be selected
//$shippingMethods = $shippingClass->checkAndGetShippingMethod($shippingId); CANNOT BE USED BECAUSE OF DIFFERENT VARIABLES IN ORDER
$shippingMethods = $shippingClass->getPossibleShippingMethods($total[0]['netto'], $total[0]['brutto'], $total[0]['quantity'], $country, $region, $total[0]['weight'], $total[0]['max_length'], $total[0]['max_width'], $total[0]['max_height'], $shippingId, 0 );
$shippingMethods = $shippingClass->getPossibleShippingMethods($total[0]['netto'], $total[0]['brutto'], $total[0]['quantity'], $country, $region, $total[0]['weight'], $total[0]['length'], $total[0]['width'], $total[0]['height'], $shippingId, 0 );



Expand All @@ -352,7 +352,7 @@ public function saveOrderMain($data) {
// Cooperates with components/com_phocacart/views/checkout/view.html.php 230

// Find all possible shipping methods (without shipping method selected) to see if there is really no rule to display any method
$shippingtMethodsAllPossible = $shippingClass->getPossibleShippingMethods($total[0]['netto'], $total[0]['brutto'], $total[0]['quantity'], $country, $region, $total[0]['weight'], $total[0]['max_length'], $total[0]['max_width'], $total[0]['max_height'], 0, 0 );
$shippingtMethodsAllPossible = $shippingClass->getPossibleShippingMethods($total[0]['netto'], $total[0]['brutto'], $total[0]['quantity'], $country, $region, $total[0]['weight'], $total[0]['length'], $total[0]['width'], $total[0]['height'], 0, 0 );
if (empty($shippingtMethodsAllPossible)) {
$shippingNotFoundAllowProceed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/libraries/phocacart/render/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function loadLazyLoad() {
return array('class' => 'ph-lazyload', 'script' => implode("\n", $s));
}

return array();
return array('class' => '', 'script' => '');
}

public function loadProductHover() {
Expand Down
8 changes: 6 additions & 2 deletions admin/libraries/phocacart/route/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,17 @@ public static function getItemsRoute($catid = '', $catidAlias = '') {
return self::_buildLink($link, $needles);
}

public static function getItemRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $lang = array()) {
public static function getItemRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $lang = array(), $forceView = 0) {

$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$option = $app->input->get( 'option', '', 'string' );
$view = $app->input->get( 'view', '', 'string' );
$view = $app->input->get( 'view', '', 'string' );

if ($forceView == 1) {
$view = 'item';// We link the view from administration - to preview the product
}
/*$catidCurrent = $app->input->get( 'id', 0, 'int' );
if ($catidCurrent > 0) {
Expand Down
23 changes: 16 additions & 7 deletions admin/libraries/phocacart/shipping/shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function setType($type = array(0,1)) {
* Always test for the id before using this function
*/

public function getPossibleShippingMethods($amountNetto, $amountBrutto, $quantity, $country, $region, $weight, $maxLength, $maxWidth, $maxHeight, $id = 0, $selected = 0) {
public function getPossibleShippingMethods($amountNetto, $amountBrutto, $quantity, $country, $region, $weight, $length, $width, $height, $id = 0, $selected = 0) {

$app = JFactory::getApplication();
$paramsC = PhocacartUtils::getComponentParameters();
Expand Down Expand Up @@ -65,7 +65,8 @@ public function getPossibleShippingMethods($amountNetto, $amountBrutto, $quantit
.' s.active_amount, s.active_quantity, s.active_zone, s.active_country, s.active_region,'
.' s.active_weight, s.active_size,'
.' s.lowest_amount, s.highest_amount, s.minimal_quantity, s.maximal_quantity, s.lowest_weight,'
.' s.highest_weight, s.default, s.maximal_length, s.maximal_width, s.maximal_height,'
.' s.highest_weight, s.default,'
.' s.minimal_length, s.minimal_width, s.minimal_height, s.maximal_length, s.maximal_width, s.maximal_height,'
.' t.id as taxid, t.title as taxtitle, t.tax_rate as taxrate, t.calculation_type as taxcalculationtype,'
.' GROUP_CONCAT(DISTINCT r.region_id) AS region,'
.' GROUP_CONCAT(DISTINCT c.country_id) AS country,'
Expand All @@ -74,7 +75,8 @@ public function getPossibleShippingMethods($amountNetto, $amountBrutto, $quantit
.' s.active_amount, s.active_quantity, s.active_zone, s.active_country, s.active_region,'
.' s.active_weight, s.active_size,'
.' s.lowest_amount, s.highest_amount, s.minimal_quantity, s.maximal_quantity, s.lowest_weight,'
.' s.highest_weight, s.default, s.maximal_length, s.maximal_width, s.maximal_height,'
.' s.minimal_length, s.minimal_width, s.minimal_height, s.maximal_length, s.maximal_width, s.maximal_height,'
.' s.highest_weight, s.default,'
.' t.id, t.title, t.tax_rate, t.calculation_type';
$groupsFast = 's.id';
$groups = PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull : $groupsFast;
Expand Down Expand Up @@ -206,15 +208,22 @@ public function getPossibleShippingMethods($amountNetto, $amountBrutto, $quantit
// Size Rule
if($v->active_size == 1) {
$sP = 0;
if ($maxLength <= $v->maximal_length || $maxLength == $v->maximal_length) {
if (($length >= $v->minimal_length || $length == $v->minimal_length)
&& ($length <= $v->maximal_length || $length == $v->maximal_length)) {

$sP++;
}
if ($maxWidth <= $v->maximal_width || $maxWidth == $v->maximal_width) {
if (($width >= $v->minimal_width || $width == $v->minimal_width)
&& ($width <= $v->maximal_width || $width == $v->maximal_width)) {

$sP++;
}
if ($maxHeight <= $v->maximal_height || $maxHeight == $v->maximal_height) {
if (($height >= $v->minimal_height || $height == $v->minimal_height)
&& ($height <= $v->maximal_height || $height == $v->maximal_height)) {

$sP++;
}

if ($sP == 3) {
$s = 1;
}
Expand Down Expand Up @@ -334,7 +343,7 @@ public function checkAndGetShippingMethods($selectedShippingId = 0, $selected =
$region = (int)$dataAddress['bregion'];
}

$shippingMethods = $this->getPossibleShippingMethods($totalFinal['netto'], $totalFinal['brutto'], $totalFinal['quantity'], $country, $region, $totalFinal['weight'], $totalFinal['max_length'], $totalFinal['max_width'], $totalFinal['max_height'], $selectedShippingId, $selected);
$shippingMethods = $this->getPossibleShippingMethods($totalFinal['netto'], $totalFinal['brutto'], $totalFinal['quantity'], $country, $region, $totalFinal['weight'], $totalFinal['length'], $totalFinal['width'], $totalFinal['height'], $selectedShippingId, $selected);


if (!empty($shippingMethods)) {
Expand Down
14 changes: 8 additions & 6 deletions admin/libraries/phocacart/stock/stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ public static function getStockStatus($stockCount, $minQuantity, $minMultipleQua
// N = 0
$app = JFactory::getApplication();
$paramsC = PhocacartUtils::getComponentParameters();
$stock_checking = $paramsC->get( 'stock_checking', 0 );
$display_stock_status = $paramsC->get( 'display_stock_status', 1 );
$stock_checkout = $paramsC->get( 'stock_checkout', 0 );
$stock_checking = $paramsC->get( 'stock_checking', 0 );
$display_stock_status = $paramsC->get( 'display_stock_status', 1 );
$stock_checkout = $paramsC->get( 'stock_checkout', 0 );
$stock_status_display_count = $paramsC->get( 'stock_status_display_count', 0 );

$stock = array();

Expand All @@ -64,6 +65,7 @@ public static function getStockStatus($stockCount, $minQuantity, $minMultipleQua
$stock['status_image'] = false;
$stock['status_link'] = false;
$stock['status_link_target'] = false;
$stock['status_display_count'] = (int)$stock_status_display_count;

$stock['stock_status_feed'] = false; // Additional status text for feeds only - it is managed by $stock['stock_status']

Expand Down Expand Up @@ -167,11 +169,11 @@ public static function getStockStatusOutput($stockStatus) {
}


if ($stockStatus['stock_status'] && $stockStatus['stock_count']) {
if ($stockStatus['stock_status'] && $stockStatus['stock_count'] !== false && $stockStatus['status_display_count'] == 1) {
$o .= $stockStatus['stock_status'] . ' ('.$stockStatus['stock_count'].')';
} else if (!$stockStatus['stock_status'] && $stockStatus['stock_count']) {
} else if (!$stockStatus['stock_status'] && $stockStatus['stock_count'] !== false) {
$o .= $stockStatus['stock_count'];
} else if ($stockStatus['stock_status'] && !$stockStatus['stock_count']) {
} else if ($stockStatus['stock_status'] /* && $stockStatus['status_display_count'] == 0*/) {
$o .= $stockStatus['stock_status'];
}

Expand Down
6 changes: 3 additions & 3 deletions admin/models/fields/phocastockstatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ protected function getInput() {
$data = $db->loadObjectList();

// DEFAULT VALUES
if ($man == 'a' && $this->value == 0) {
/* if ($man == 'a' && $this->value == 0) {
$this->value = 2; // set default value for products in stock
} else if ($man == 'n' && $this->value == 0) {
$this->value = 1;// set default value when there is no product in stock
}
} */

if (!empty($data)) {
foreach($data as $k => $v) {
$v->text = JText::_($v->text);
}
}

array_unshift($data, JHtml::_('select.option', '', '- '.JText::_('COM_PHOCACART_SELECT_STOCK_STATUS').' -', 'value', 'text'));
array_unshift($data, JHtml::_('select.option', '0', '- '.JText::_('COM_PHOCACART_SELECT_STOCK_STATUS').' -', 'value', 'text'));
return JHtml::_('select.genericlist', $data, $this->name, 'class="inputbox"', 'value', 'text', $this->value, $this->id );
}
}
Expand Down
Loading

0 comments on commit 28c1e57

Please sign in to comment.