Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #105 from J2Store4/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
alagesanbe08 authored May 7, 2024
2 parents 3ab6a5e + 603172a commit 4080bb0
Show file tree
Hide file tree
Showing 20 changed files with 123 additions and 104 deletions.
4 changes: 2 additions & 2 deletions administrator/components/com_j2store/helpers/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public static function getInstance(array $config = array())
return self::$instance;
}

public function set($namekey,$value=null){
public function set($namekey,$value=''){
if(!isset($this->_data[$namekey]) || !is_object($this->_data[$namekey])) $this->_data[$namekey] = new stdClass();
$this->_data[$namekey]->config_meta_value=$value;
$this->_data[$namekey]->config_meta_key=$namekey;
return true;
}

public function get($property, $default=null) {
public function get($property, $default='') {
if(isset($this->_data[$property])) {
return $this->_data[$property]->config_meta_value;
}
Expand Down
5 changes: 4 additions & 1 deletion administrator/components/com_j2store/helpers/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ public function processTags($text, $order, $extras=array(), $receiver_type = '*'
$conf = JFactory::getConfig();
$debug = $conf->get('debug_lang');
$language = JLanguage::getInstance($order->customer_language, $debug);
$language->load('com_j2store');
//$language = \Joomla\CMS\Language\Language::getInstance($order->customer_language,false);
}

Expand Down Expand Up @@ -495,7 +496,9 @@ public function processTags($text, $order, $extras=array(), $receiver_type = '*'
$tags = array_merge($tags, $extras);
foreach ($tags as $key => $value)
{
$text = str_replace($key, $value, $text);
if (!empty($key) && !is_null($value) && !empty($text)) {
$text = str_replace($key, $value, $text);
}
}
//process custom fields.
//billing Format [CUSTOM_BILLING_FIELD:KEYNAME]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ public function onAjaxActivateLicence()
$params = array(
'license' => $license,
'url' => $baseURL,
'item_name' => $plugin->element,
'element' => $plugin->element
);
$response = $license_helper->activateLicense($params);
Expand Down Expand Up @@ -387,6 +388,7 @@ public function onAjaxDeActivateLicence()
$params = array(
'license' => $license,
'url' => $baseURL,
'item_name' => $plugin->element,
'element' => $plugin->element
);
$response = $license_helper->deActivateLicense($params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function onBeforeAddCartItem(&$model, $product, &$json) {
{
foreach($child as $index => $attr){

if(count($attr['optionvalue']) > 0 && $attr['required'] && !array_key_exists($attr['productoption_id'],$options)) // if optionvalue exist or not. then only display form.otherwise form display only heading without option name
if(is_array($attr['optionvalue']) && count($attr['optionvalue']) > 0 && $attr['required'] && !array_key_exists($attr['productoption_id'],$options)) // if optionvalue exist or not. then only display form.otherwise form display only heading without option name
{
array_push($ommit_check,$attr['productoption_id']);
}
Expand All @@ -71,7 +71,7 @@ public function onBeforeAddCartItem(&$model, $product, &$json) {
{
foreach($child as $index => $attr){

if(count($attr['optionvalue']) > 0 && $attr['required'] && !array_key_exists($attr['productoption_id'],$options)) // if optionvalue exist or not. then only display form.otherwise form display only heading without option name
if(is_array($attr['optionvalue']) && count($attr['optionvalue']) > 0 && $attr['required'] && !array_key_exists($attr['productoption_id'],$options)) // if optionvalue exist or not. then only display form.otherwise form display only heading without option name
{
array_push($ommit_check,$attr['productoption_id']);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ public function onValidateCart(&$model, $cartitem, $quantity) {

//get the quantity difference. Because we are going to check the total quantity
$difference_qty = $quantity - $cartitem->product_qty;

//validate minimum / maximum quantity
$error = $product_helper->validateQuantityRestriction($variant , $cart_total_qty, $difference_qty);
if(!empty($error)) {
Expand All @@ -215,7 +215,7 @@ public function onValidateCart(&$model, $cartitem, $quantity) {
$errors[] = JText::_('J2STORE_OUT_OF_STOCK');
}

if(count($errors)) {
if(is_array($errors) && count($errors)) {
throw new Exception(implode('/n', $errors));
return false;
}
Expand Down
40 changes: 21 additions & 19 deletions administrator/components/com_j2store/models/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,23 +318,23 @@ protected function _buildQueryOrderBy(&$query){
private function getFilterValues()
{
return (object)array(
'search' => $this->getState('search',null,'string'),
'title' => $this->getState('title',null,'string'),
'user_id' => $this->getState('user_id',null,'int'),
'order_id' => $this->getState('order_id',null,'int'),
'orderstate' => $this->getState('orderstate',null,'int'),
'processor' => $this->getState('processor',null,'string'),
'paykey' => $this->getState('paykey',null,'string'),
'since' => $this->getState('since',null,'string'),
'until' => $this->getState('until',null,'string'),
'groupbydate' => $this->getState('groupbydate',null,'int'),
'groupbylevel' => $this->getState('groupbylevel',null,'int'),
'moneysum' => $this->getState('moneysum',null,'float'),
'coupon_id' => $this->getState('coupon_id',null,'int'),
'coupon_code' => $this->getState('coupon_code',null,'string'),
'nozero' => $this->getState('nozero',null,'int'),
'frominvoice' => $this->getState('frominvoice',null,'int'),
'toinvoice' => $this->getState('toinvoice',null,'int'),
'search' => $this->getState('search','','string'),
'title' => $this->getState('title','','string'),
'user_id' => $this->getState('user_id',0,'int'),
'order_id' => $this->getState('order_id',0,'int'),
'orderstate' => $this->getState('orderstate',0,'int'),
'processor' => $this->getState('processor','','string'),
'paykey' => $this->getState('paykey','','string'),
'since' => $this->getState('since',0,'string'),
'until' => $this->getState('until',0,'string'),
'groupbydate' => $this->getState('groupbydate',0,'int'),
'groupbylevel' => $this->getState('groupbylevel',0,'int'),
'moneysum' => $this->getState('moneysum',0,'float'),
'coupon_id' => $this->getState('coupon_id',0,'int'),
'coupon_code' => $this->getState('coupon_code',0,'string'),
'nozero' => $this->getState('nozero',0,'int'),
'frominvoice' => $this->getState('frominvoice',0,'int'),
'toinvoice' => $this->getState('toinvoice',0,'int'),
'orderstatus' => $this->getState('orderstatus',array()),
'token' => $this->getState('token',''),
'user_email' => $this->getState('user_email',''),
Expand Down Expand Up @@ -414,7 +414,8 @@ function _buildTotalQueryWhere(&$query){
}
$tz = JFactory::getConfig()->get('offset');
//since
$since = trim($state->since);
$since = trim($state->since);

if(empty($since) || ($since == '0000-00-00') || ($since == '0000-00-00 00:00:00')) {
$since = '';
} else {
Expand All @@ -431,7 +432,8 @@ function _buildTotalQueryWhere(&$query){
}

// "Until" queries
$until = trim($state->until);
$until = trim($state->until);

if(empty($until) || ($until == '0000-00-00') || ($until == '0000-00-00 00:00:00')) {
$until = '';
} else {
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_j2store/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
defined('_JEXEC') or die('Restricted Access');

define('J2STORE_PRO', '1');
define('J2STORE_VERSION', '4.0.4');
define('J2STORE_DATE', '2023-12-12');
define('J2STORE_VERSION', '4.0.5');
define('J2STORE_DATE', '2024-05-08');


6 changes: 3 additions & 3 deletions com_j2store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<extension version="2.5" type="component" method="upgrade">
<name>J2Store</name>
<author>Ramesh Elamathi</author>
<creationDate>DEC 2023</creationDate>
<copyright>Copyright (c) 2023 Cartrabbit. All rights reserved.</copyright>
<creationDate>MAY 2024</creationDate>
<copyright>Copyright (c) 2024 Cartrabbit. All rights reserved.</copyright>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.j2store.org</authorUrl>
<version>4.0.4</version>
<version>4.0.5</version>
<license>https://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description><![CDATA[<h3>J2 Store V4 Professional</h3>
Flexible and native Joomla shopping cart solution. <br />
Expand Down
13 changes: 7 additions & 6 deletions components/com_j2store/controllers/myprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public function validate($order) {
}
// if its guest
} elseif($guest_token && $guest_order_email) {
if(($order->user_email == $guest_order_email) && ($order->token == $guest_token)) {
if((trim($order->user_email) == $guest_order_email) && (trim($order->token) == $guest_token)) {
$status = true;
}
}
Expand All @@ -505,14 +505,15 @@ function guestentry() {

//check token
JSession::checkToken() or jexit('Invalid Token');
$app = JFactory::getApplication();
$post = $app->input->getArray($_REQUEST);
//$app = JFactory::getApplication();
//$post = $app->input->getArray($_REQUEST);
$platform= J2Store::platform();
$email = $this->input->getString('email', '');
$token = $this->input->getString('order_token', '');
$link = J2Store::platform()->getMyprofileUrl();//JRoute::_('index.php?option=com_j2store&view=myprofile');
if(empty($email) || empty($token)) {
$msg = JText::_('J2STORE_ORDERS_GUEST_VALUES_REQUIRED');
$app->redirect($link, $msg);
$platform->redirect($link, $msg);
}

//checks
Expand All @@ -522,14 +523,14 @@ function guestentry() {

} else {
$msg = JText::_('J2STORE_ORDERS_GUEST_INVALID_EMAIL');
$app->redirect($link, $msg);
$platform->redirect($link, $msg);
}

if(F0FTable::getInstance('Order', 'J2StoreTable')->load(array('token'=>$token, 'user_email'=>$email))) {
$session->set('guest_order_token', $token, 'j2store');
} else {
$msg = JText::_('J2STORE_ORDERS_GUEST_INVALID_TOKEN');
$app->redirect($link, $msg);
$platform->redirect($link, $msg);
}
$this->setRedirect($link);
return;
Expand Down
2 changes: 1 addition & 1 deletion components/com_j2store/controllers/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function browse() {
$uri = JURI::getInstance();
$document->setMetaData('og:title', $document->getTitle(),'property');
$document->setMetaData('og:site_name', $app->get('sitename'),'property');
$document->setMetaData('og:description', strip_tags($document->getDescription()),'property');
$document->setMetaData('og:description', strip_tags($document->getDescription()),'property');
$document->setMetaData('og:url', $uri->toString(),'property');
$document->setMetaData('og:type', 'product.group','property');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function j2storeGetPaymentForm(element, container) {

<?php
//custom fields
$html = $this->storeProfile->get('store_payment_layout');
$html =$this->storeProfile->get('store_payment_layout','') ;

//first find all the checkout fields
preg_match_all("^\[(.*?)\]^",$html,$checkoutFields, PREG_PATTERN_ORDER);
Expand Down
1 change: 1 addition & 0 deletions components/com_j2store/views/myprofile/tmpl/orderitems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$conf = JFactory::getConfig();
$debug = $conf->get('debug_lang');
$language = JLanguage::getInstance($order->customer_language, $debug);
$language->load('com_j2store');
}
?>
<div style="page-break-inside: avoid;">
Expand Down
Loading

0 comments on commit 4080bb0

Please sign in to comment.