Skip to content

Commit

Permalink
3.3.2
Browse files Browse the repository at this point in the history
3.3.2
  • Loading branch information
PhocaCz committed Aug 25, 2019
1 parent b32132e commit 9ab7347
Show file tree
Hide file tree
Showing 85 changed files with 1,961 additions and 670 deletions.
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ Phoca Cart is e-commerce extension - powerful shopping cart for Joomla! CMS. Pho

[Phoca Cart Demo - Phoca Stock Photo](https://www.phoca.cz/stockphoto/)

[Phoca Cart - Astroid Framework Demo](https://www.phoca.cz/phocacartdemo/astroid/)



## Version

3.3.1
3.3.2



Expand Down
53 changes: 41 additions & 12 deletions admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="category_askquestion" type="list" default="0" label="COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_CATEGORY_VIEW_LABEL" description="COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_CATEGORY_VIEW_DESC">
<option value="1">COM_PHOCACART_YES</option>
<option value="0">COM_PHOCACART_NO</option>
<option value="2">COM_PHOCACART_YES_ONLY_IF_ADD_TO_CART_NOT_DISPLAYED</option>
</field>


<field name="phocahead5" type="phocahead" default="COM_PHOCACART_ITEM_VIEW_LABEL" label="" description=""/>

Expand Down Expand Up @@ -302,13 +308,6 @@
<option value="2">COM_PHOCACART_YES_ONLY_IF_ADD_TO_CART_NOT_DISPLAYED</option>
</field>

<field name="popup_askquestion" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_LABEL"
description="COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_DESC">
<option value="1">COM_PHOCACART_YES_WINDOW_POPUP</option>
<option value="2">COM_PHOCACART_YES_MODAL_POPUP</option>
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="display_public_download" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCACART_FIELD_DISPLAY_PUBLIC_DOWNLOAD_BUTTON_LABEL"
description="COM_PHOCACART_FIELD_DISPLAY_PUBLIC_DOWNLOAD_BUTTON_DESC">
<option value="1">COM_PHOCACART_YES</option>
Expand Down Expand Up @@ -421,6 +420,24 @@
<option value="1">COM_PHOCACART_YES</option>
</field>

<field name="display_zero_total" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCACART_FIELD_DISPLAY_ZERO_TOTAL_LABEL" description="COM_PHOCACART_FIELD_DISPLAY_ZERO_TOTAL_DESC">
<option value="1">COM_PHOCACART_YES</option>
<option value="0">COM_PHOCACART_NO</option>
</field>


<field name="display_apply_coupon_form" type="list" class="btn-group btn-group-yesno" default="0" label="COM_PHOCACART_FIELD_DISPLAY_APPLY_COUPON_FORM_LABEL" description="COM_PHOCACART_FIELD_DISPLAY_APPLY_COUPON_FORM_DESC">
<option value="1">COM_PHOCACART_IN_PAYMENT_METHOD_FORM</option>
<option value="2">COM_PHOCACART_BEFORE_LOGIN_FORM</option>
<option value="3">COM_PHOCACART_AFTER_LOGIN_FORM</option>
</field>

<field name="display_apply_reward_points_form" type="list" class="btn-group btn-group-yesno" default="0" label="COM_PHOCACART_FIELD_DISPLAY_APPLY_REWARD_POINTS_FORM_LABEL" description="COM_PHOCACART_FIELD_DISPLAY_APPLY_REWARD_POINTS_FORM_DESC">
<option value="1">COM_PHOCACART_IN_PAYMENT_METHOD_FORM</option>
<option value="2">COM_PHOCACART_BEFORE_LOGIN_FORM</option>
<option value="3">COM_PHOCACART_AFTER_LOGIN_FORM</option>
</field>


<field name="phocahead30" type="phocahead" default="COM_PHOCACART_USER_ACCOUNT_VIEW_LABEL" label="" description=""/>

Expand Down Expand Up @@ -597,9 +614,12 @@
<option value="2">COM_PHOCACART_UP_DOWN</option>
</field>

<field name="zero_price_label" default="" size="20" type="text" label="COM_PHOCACART_FIELD_ZERO_PRICE_LABEL_LABEL" description="COM_PHOCACART_FIELD_ZERO_PRICE_LABEL_DESC"/>
<field name="zero_price_text" default="" size="20" type="text" label="COM_PHOCACART_FIELD_ZERO_PRICE_TEXT_LABEL" description="COM_PHOCACART_FIELD_ZERO_PRICE_TEXT_DESC"/>

<field name="zero_price_label" default="" size="20" type="text" label="COM_PHOCACART_FIELD_ZERO_PRICE_LABEL_LABEL" description="COM_PHOCACART_FIELD_ZERO_PRICE_LABEL_DESC"/>
<field name="price_on_demand_label" default="" size="20" type="text" label="COM_PHOCACART_FIELD_PRICE_ON_DEMAND_LABEL_LABEL" description="COM_PHOCACART_FIELD_PRICE_ON_DEMAND_LABEL_DESC"/>
<field name="price_on_demand_text" default="" size="20" type="text" label="COM_PHOCACART_FIELD_PRICE_ON_DEMAND_TEXT_LABEL" description="COM_PHOCACART_FIELD_PRICE_ON_DEMAND_TEXT_DESC"/>


<field name="hide_add_to_cart_zero_price" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCACART_FIELD_HIDE_ADD_TO_CART_PRODUCT_ZERO_PRICE_LABEL"
description="COM_PHOCACART_FIELD_HIDE_ADD_TO_CART_PRODUCT_ZERO_PRICE_DESC">
Expand All @@ -624,6 +644,13 @@
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="popup_askquestion" type="list" class="btn-group btn-group-yesno" default="1" label="COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_LABEL"
description="COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_DESC">
<option value="1">COM_PHOCACART_YES_WINDOW_POPUP</option>
<option value="2">COM_PHOCACART_YES_MODAL_POPUP</option>
<option value="0">COM_PHOCACART_NO</option>
</field>

<field name="phocahead8" type="phocahead" default="COM_PHOCACART_AJAX_OPTIONS_LABEL" label="" description=""/>


Expand Down Expand Up @@ -751,9 +778,10 @@
<option value="2">COM_PHOCACART_CHANGE_TAXES_TOTAL_AMOUNT_AND_ROUNDING_CALCULATION</option>
</field>

<field name="enable_coupons" type="list" default="1" label="COM_PHOCACART_FIELD_ENABLE_COUPONS_LABEL" description="COM_PHOCACART_FIELD_ENABLE_COUPONS_DESC">
<field name="enable_coupons" type="list" default="2" label="COM_PHOCACART_FIELD_ENABLE_COUPONS_LABEL" description="COM_PHOCACART_FIELD_ENABLE_COUPONS_DESC">
<option value="0">COM_PHOCACART_NO</option>
<option value="1">COM_PHOCACART_YES</option>
<option value="2">COM_PHOCACART_YES_USER_LOGGED_IN_GUEST_CHECKOUT_ENABLED</option>
</field>

<field name="enable_rewards" type="list" default="1" label="COM_PHOCACART_FIELD_ENABLE_REWARD_POINTS_LABEL" description="COM_PHOCACART_FIELD_ENABLE_REWARD_POINTS_DESC">
Expand Down Expand Up @@ -1040,7 +1068,8 @@


<field name="enable_logging" default="0" type="radio" class="btn-group btn-group-yesno" label="COM_PHOCACART_FIELD_ENABLE_LOGGING_LABEL" description="COM_PHOCACART_FIELD_ENABLE_LOGGING_DESC">
<option value="1">COM_PHOCACART_YES</option>
<option value="1">COM_PHOCACART_YES_ALL</option>
<option value="2">COM_PHOCACART_YES_ERRORS_ONLY</option>
<option value="0">COM_PHOCACART_NO</option>
</field>

Expand Down Expand Up @@ -1114,7 +1143,7 @@
</field>

<field name="upload_maxsize" type="phocatext" size="20" default="3145728" label="COM_PHOCACART_FIELD_MAXIMUM_SIZE_UPLOAD_FILE_LABEL" description="COM_PHOCACART_FIELD_MAXIMUM_SIZE_UPLOAD_FILE_DESC"/>

<field name="ignore_file_types_check" default="0" type="list" label="COM_PHOCACART_IGNORE_FILE_TYPES_CHECK_LABEL" description="COM_PHOCACART_IGNORE_FILE_TYPES_CHECK_DESC" >
<!--<option value="1">COM_PHOCACART_YES_UPLOAD_PARAM</option>
<option value="2">COM_PHOCACART_YES_UPLOAD_PARAM_ADMIN</option>
Expand Down Expand Up @@ -1242,7 +1271,7 @@

<field name="product_image_path" default="images/phocacartproducts" size="4" type="text" label="COM_PHOCACART_FIELD_PRODUCT_IMAGE_PATH_LABEL" description="COM_PHOCACART_FIELD_PRODUCT_IMAGE_PATH_DESC"/>
<field name="category_image_path" default="images/phocacartcategories" size="4" type="text" label="COM_PHOCACART_FIELD_CATEGORY_IMAGE_PATH_LABEL" description="COM_PHOCACART_FIELD_CATEGORY_IMAGE_PATH_DESC"/>

<field name="thumb_name_prefix" default="phoca_thumb" size="4" type="text" label="COM_PHOCACART_FIELD_THUMBNAIL_NAME_PREFIX_LABEL" description="COM_PHOCACART_FIELD_THUMBNAIL_NAME_PREFIX_DESC"/>


Expand Down
1 change: 1 addition & 0 deletions admin/install/sql/mysql/install.utf8.sql
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ CREATE TABLE IF NOT EXISTS `#__phocacart_order_statuses` (
`email_customer` tinyint(1) NOT NULL DEFAULT '0',
`email_others` text,
`email_text` text,
`email_footer` text,
`email_text_others` text,
`email_subject` varchar(255) NOT NULL DEFAULT '',
`email_subject_others` varchar(255) NOT NULL DEFAULT '',
Expand Down
38 changes: 37 additions & 1 deletion admin/language/en-GB/en-GB.com_phocacart.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,42 @@ COM_PHOCACART_ORDER_PAYMENT_PROCESSED_DOWNLOADABLE_ITEMS_ADDITIONAL_INFO=""
COM_PHOCACART_ORDER_PAYMENT_CANCELED_ADDITIONAL_INFO=""


;[3.3.2]
COM_PHOCACART_NOTICE="Notice"
COM_PHOCACART_WARNING="Warning"
COM_PHOCACART_GENERAL="General"
COM_PHOCACART_YES_ALL="Yes (All)"
COM_PHOCACART_YES_ERRORS_ONLY="Yes (Errors Only)"
COM_PHOCACART_APPLYING_COUPONS_IS_DISABLED="Applying coupons is disabled"
COM_PHOCACART_YES_USER_LOGGED_IN_GUEST_CHECKOUT_ENABLED="Yes (User must be logged in or guest checkout is enabled)"
COM_PHOCACART_IN_PAYMENT_METHOD_FORM="In Payment Method Form"
COM_PHOCACART_BEFORE_LOGIN_FORM="Before Login Form"
COM_PHOCACART_AFTER_LOGIN_FORM="After Login Form"
COM_PHOCACART_FIELD_DISPLAY_APPLY_COUPON_FORM_LABEL="Display Apply Coupon Form"
COM_PHOCACART_FIELD_DISPLAY_APPLY_COUPON_FORM_DESC="Set where Apply Coupon form will be displayed in checkout view. Don't forget to enable 'Enable Coupons' parameter."
COM_PHOCACART_FIELD_DISPLAY_APPLY_REWARD_POINTS_FORM_LABEL="Display Apply Reward Points Form"
COM_PHOCACART_FIELD_DISPLAY_APPLY_REWARD_POINTS_FORM_DESC="Set where Apply Reward Points form will be displayed in checkout view. Don't forget to enable 'Enable Reward Points' parameter."
COM_PHOCACART_REWARD_POINTS_REMOVED="Reward Points removed"
COM_PHOCACART_CHANGE_REWARD_POINTS="Change Reward Points"
COM_PHOCACART_APPLY_REWARD_POINTS="Apply Reward Points"
COM_PHOCACART_PLEASE_LOG_IN_TO_APPLY_COUPON_FIRST="Please log in to apply coupon first"
COM_PHOCACART_PLEASE_LOG_IN_OR_ENABLE_GUEST_CHECKOUT_TO_APPLY_COUPON_FIRST="Please log in or enable guest checkout to apply coupon first"
COM_PHOCACART_APPLY_COUPON="Apply Coupon"
COM_PHOCACART_REMOVE_COUPON="Remove Coupon"
COM_PHOCACART_COUPON_NOT_SET="Coupon is not set"
COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_CATEGORY_VIEW_LABEL="Ask A Question Button (Category, Items View)"
COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_CATEGORY_VIEW_DESC="Display or hide Ask A Question button in Category and Items view. Ask A Question function needs to be enabled in Ask Question/Feedback/Report Options"
COM_PHOCACART_MIXED_PRODUCT_DIGITAL_PHYSICAL="Mixed Product (Physical And Digital Product)"
COM_PHOCACART_PRICE_ON_DEMAND_PRODUCT="Price On Demand Product"
COM_PHOCACART_FIELD_PRICE_ON_DEMAND_LABEL_LABEL="Price On Demand Label"
COM_PHOCACART_FIELD_PRICE_ON_DEMAND_LABEL_DESC="Set text which will be displayed instead of price label when product type is 'Price On Demand'. If '0' is set then no text will be displayed. If some text is set then this text will be displayed instead of price label. See documentation for examples."
COM_PHOCACART_FIELD_PRICE_ON_DEMAND_TEXT_LABEL="Price On Demand Text"
COM_PHOCACART_FIELD_PRICE_ON_DEMAND_TEXT_DESC="Set text which will be displayed instead of price text when product type is 'Price On Demand'. If '0' is set then no text will be displayed. If some text is set then this text will be displayed instead of price. See documentation for examples."
COM_PHOCACART_FIELD_EMAIL_FOOTER_LABEL="Email Footer (Customer)"
COM_PHOCACART_FIELD_EMAIL_FOOTER_DESC="Set the footer for the email sent to the customer"
COM_PHOCACART_FIELD_DISPLAY_ZERO_TOTAL_LABEL="Display Zero Total"
COM_PHOCACART_FIELD_DISPLAY_ZERO_TOTAL_DESC="Display or hide total amount which is equal to zero in checkout and cart."

;[3.3.1]
COM_PHOCACART_YES_XML_FEED="Yes (XML Feed)"
COM_PHOCACART_NO_ACTIVE_FEED_PLUGIN_FOUND="No active XML Feed plugin found"
Expand Down Expand Up @@ -1361,7 +1397,7 @@ COM_PHOCACART_FIELD_IP_LABEL="IP"
COM_PHOCACART_FIELD_IP_DESC="Set IP"
COM_PHOCACART_FIELD_MESSAGE_LABEL="Message"
COM_PHOCACART_FIELD_MESSAGE_DESC="Set message"
COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_ITEM_VIEW_LABEL="Ask A Question Button"
COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_ITEM_VIEW_LABEL="Ask A Question Button (Item View)"
COM_PHOCACART_FIELD_ASK_A_QUESTION_BUTTON_ITEM_VIEW_DESC="Display or hide Ask A Question button in Product view. Ask A Question function needs to be enabled in Ask Question/Feedback/Report Options"
COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_LABEL="Ask A Question Popup"
COM_PHOCACART_FIELD_ASK_A_QUESTION_POPUP_ITEM_VIEW_DESC="Display Ask A Question form in Popup window or on standard page"
Expand Down
6 changes: 3 additions & 3 deletions admin/libraries/phocacart/attribute/attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static function storeAttributesById($productId, $attributesArray, $new =
// Transform checkbox to INT (1 or 0)
// And check if there are more default values which is not possible e.g. for select box
$defaultValue = 0;
//PhocacartLog::add(1, $v['title'] . '- '. $v2['title']. $v2['type']. ' - '. $v2['default_value']);
//PhocacartLog::add(3, $v['title'] . '- '. $v2['title']. $v2['type']. ' - '. $v2['default_value']);

// can be "on" (sent by form) or "0" or "1" sent by database e.g. in batch
if (isset($v2['default_value']) && $v2['default_value'] != '0') {
Expand Down Expand Up @@ -623,7 +623,7 @@ public static function storeAttributesById($productId, $attributesArray) {
// Transform checkbox to INT (1 or 0)
// And check if there are more default values which is not possible e.g. for select box
$defaultValue = 0;
//PhocacartLog::add(1, $v['title'] . '- '. $v2['title']. $v2['type']. ' - '. $v2['default_value']);
//PhocacartLog::add(3, $v['title'] . '- '. $v2['title']. $v2['type']. ' - '. $v2['default_value']);
// can be "on" (sent by form) or "0" or "1" sent by database e.g. in batch
if (isset($v2['default_value']) && $v2['default_value'] != '0') {
Expand Down Expand Up @@ -1046,7 +1046,7 @@ public static function checkRequiredAttributes($id, $attributes) {

if (!empty($msgA)) {
//$u = PhocacartUser::getUserInfo();
//PhocacartLog::add(1, implode(' ', $msgA), $id, 'IP: '. $u['ip'].', User ID: '.$u['id'] . ', User Name: '.$u['username']);
//PhocacartLog::add(3, implode(' ', $msgA), $id, 'IP: '. $u['ip'].', User ID: '.$u['id'] . ', User Name: '.$u['username']);
}
return $passAll;
}
Expand Down
24 changes: 12 additions & 12 deletions admin/libraries/phocacart/captcha/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
class PhocacartCaptchaRecaptcha
{
public static function render() {

$document = JFactory::getDocument();
$pC = PhocacartUtils::getComponentParameters();
$siteKey = strip_tags(trim($pC->get( 'recaptcha_sitekey', '' )));

$document->addScript('https://www.google.com/recaptcha/api.js');
return '<div class="g-recaptcha" data-sitekey="'.$siteKey.'"></div>';
}
public static function isValid() {

$app = JFactory::getApplication();
$pC = PhocacartUtils::getComponentParameters();
$secretKey = strip_tags(trim($pC->get( 'recaptcha_privatekey', '' )));
Expand All @@ -31,12 +31,12 @@ public static function isValid() {
$response = $app->input->post->get('g-recaptcha-response', '', 'string');
$remoteIp = $_SERVER['REMOTE_ADDR'];
$urlVerify = 'https://www.google.com/recaptcha/api/siteverify';

$recaptchaMethod = $pC->get( 'recaptcha_request_method', 2 );//1 file_get_contents, 2 curl

try {


if ($recaptchaMethod == 1) {
// FILE GET CONTENTS
$data = ['secret' => $secretKey,
Expand All @@ -47,7 +47,7 @@ public static function isValid() {
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
'content' => http_build_query($data)
]
];

Expand All @@ -68,21 +68,21 @@ public static function isValid() {
'remoteip' => $remoteIp],
CURLOPT_RETURNTRANSFER => true
]);

$result = curl_exec($ch);
curl_close($ch);
}

//$resultString = print r($result, true);
//PhocacartLog::add(1, 'Ask a Question - Captcha Result', 0, $resultString);
//PhocacartLog::add(3, 'Ask a Question - Captcha Result', 0, $resultString);
if (!$result) {
return false;
}
return json_decode($result)->success;

}
catch (Exception $e) {
return null;
}
}
}
}
29 changes: 22 additions & 7 deletions admin/libraries/phocacart/cart/calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function calculateBasicProducts(&$fullItems, &$fullItemsGroup, &$total, &
$total['countallproducts'] = 0;
$total['countphysicalproducts'] = 0;
$total['countdigitalproducts'] = 0;
$total['countpriceondemandproducts']= 0;

// OPTIONS (VARIANTS) QUANTITY
// The same option can be in different items
Expand Down Expand Up @@ -281,12 +282,21 @@ public function calculateBasicProducts(&$fullItems, &$fullItemsGroup, &$total, &
$total['tax'][$taxKey]['type'] = $itemD->taxcalculationtype;
$total['tax'][$taxKey]['rate'] = $itemD->taxrate;

// Digital product
// PRODUCTTYPE Digital product
$total['countallproducts']++;
if ($itemD->type == 0) {
$total['countphysicalproducts']++;
} else if ($itemD->type == 1) {
$total['countdigitalproducts']++;
} else if ($itemD->type == 2) {
// physical and digital
// This rule can be changed but for now e.g. we test if the product is digital to ensure that the shipping will be skipped
// if the product is both - digital and physical, we cannot skip shipping so we do not count it as digital
// Uncomment if you need to opposite rule
//$total['countphysicalproducts']++;
//$total['countdigitalproducts']++;
} else if ($itemD->type == 3) {
$total['countpriceondemandproducts']++;
}

// ==========
Expand Down Expand Up @@ -781,6 +791,7 @@ public function recalculateCartDiscounts(&$fullItems, &$fullItemsGroup, &$total)
// ============
// CART COUPON
// ============

/*
* $coupon ... coupon ID and Title set in checkout
* $couponO ... coupon object
Expand All @@ -797,6 +808,7 @@ public function calculateCartCoupons(&$fullItems, &$fullItemsGroup, &$total, &$c

$validCoupon = $couponO->checkCoupon(0, $v['id'], $v['catid'], $total['quantity'], $total['netto']);


if ($validCoupon) {
$validCouponId = $couponDb['id'];
$validCouponAmount = $couponDb['discount'];
Expand Down Expand Up @@ -859,12 +871,15 @@ public function calculateCartCoupons(&$fullItems, &$fullItemsGroup, &$total, &$c

/*
*
* Must be done in recalculateCartCoupons
if (isset($fullItems[$k]['nettodiscount']) && !$this->posbruttocalculation) {
$fullItems[$k]['finaldiscount'] = $fullItems[$k]['nettodiscount'] * $v['quantity'];
} else if (isset($fullItems[$k]['bruttodiscount'])) {
$fullItems[$k]['finaldiscount'] = $fullItems[$k]['bruttodiscount'] * $v['quantity'];
} */
* Must be done in recalculateCartCoupons for fixed coupons
*/
if ($couponDb['calculation_type'] != 0) {
if (isset($fullItems[$k]['nettodiscount']) && !$this->posbruttocalculation) {
$fullItems[$k]['finaldiscount'] = $fullItems[$k]['nettodiscount'] * $v['quantity'];
} else if (isset($fullItems[$k]['bruttodiscount'])) {
$fullItems[$k]['finaldiscount'] = $fullItems[$k]['bruttodiscount'] * $v['quantity'];
}
}

if ($this->correctsubtotal) {
$this->correctSubTotal($fullItems[$k], $total);
Expand Down
Loading

0 comments on commit 9ab7347

Please sign in to comment.