Created
July 2, 2013 04:37
-
-
Save gunjanpatel/5906809 to your computer and use it in GitHub Desktop.
This patch is a fix for redSHOP product back-end sorting / ordering issue for version 1.2 and lower.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 0d297c73af187e5eedd2b3d36ddbca79251fcea4 Mon Sep 17 00:00:00 2001 | |
| From: Gunjan Patel <gunjan@redcomponent.com> | |
| Date: Fri, 17 May 2013 17:43:24 +0530 | |
| Subject: [PATCH 1/3] fix sorting issue on product listing page | |
| --- | |
| component/admin/models/product.php | 18 ++++++++---------- | |
| 1 file changed, 8 insertions(+), 10 deletions(-) | |
| diff --git a/component/admin/models/product.php b/component/admin/models/product.php | |
| index c785f60..12b2e9c 100644 | |
| --- a/component/admin/models/product.php | |
| +++ b/component/admin/models/product.php | |
| @@ -57,7 +57,7 @@ public function getData() | |
| { | |
| if (empty($this->_data)) | |
| { | |
| - $query = $this->_buildQuery(); | |
| + $query = $this->_buildQuery(); | |
| $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); | |
| // Product parent - child - format generation | |
| @@ -74,7 +74,7 @@ public function getData() | |
| // First pass - collect children | |
| foreach ($products as $v) | |
| { | |
| - $pt = $v->parent; | |
| + $pt = $v->parent_id = $v->parent; | |
| $list = @$children[$pt] ? $children[$pt] : array(); | |
| array_push($list, $v); | |
| $children[$pt] = $list; | |
| @@ -82,7 +82,7 @@ public function getData() | |
| // Second pass - get an indent list of the items | |
| $this->_data = JHTML::_('menu.treerecurse', 0, '', array(), $children, max(0, 9)); | |
| - sort($this->_data); | |
| + $this->_data = array_merge(array(), $this->_data); | |
| } | |
| return $this->_data; | |
| @@ -252,9 +252,9 @@ public function _buildQuery() | |
| if ($search_field == 'pa.property_number' && $keyword != '') | |
| { | |
| - $query .= "LEFT JOIN " . $this->_table_prefix . "product_attribute AS a ON a.product_id = p.product_id " . | |
| - "LEFT JOIN " . $this->_table_prefix . "product_attribute_property AS pa ON pa.attribute_id = a.attribute_id " . | |
| - "LEFT JOIN " . $this->_table_prefix . "product_subattribute_color AS ps ON ps.subattribute_id = pa.property_id "; | |
| + $query .= "LEFT JOIN " . $this->_table_prefix . "product_attribute AS a ON a.product_id = p.product_id " | |
| + . "LEFT JOIN " . $this->_table_prefix . "product_attribute_property AS pa ON pa.attribute_id = a.attribute_id " | |
| + . "LEFT JOIN " . $this->_table_prefix . "product_subattribute_color AS ps ON ps.subattribute_id = pa.property_id "; | |
| } | |
| $query .= "WHERE 1=1 "; | |
| @@ -500,9 +500,7 @@ public function gbasefeed($data) | |
| if (trim($additional_images[$ad]->product_full_image) != trim($additional_images[$ad]->media_name) | |
| && trim($additional_images[$ad]->media_name) != "") | |
| { | |
| - $add_image .= "<g:additional_image_link>" . $product_img_url . | |
| - htmlspecialchars($additional_images[$ad]->media_name, ENT_NOQUOTES, "UTF-8") . | |
| - "</g:additional_image_link>"; | |
| + $add_image .= "<g:additional_image_link>" . $product_img_url . htmlspecialchars($additional_images[$ad]->media_name, ENT_NOQUOTES, "UTF-8") . "</g:additional_image_link>"; | |
| } | |
| } | |
| @@ -749,7 +747,7 @@ public function treerecurse($id, $indent, $list, &$children, $maxlevel = 9999, $ | |
| * $order = product current ordring | |
| * @return: boolean | |
| */ | |
| - public function saveorder($cid = array(), $order) | |
| + public function saveorder($cid = array(), $order = 0) | |
| { | |
| $app = JFactory::getApplication(); | |
| -- | |
| 1.8.1.6 | |
| From 8d012e7370c415902e4868b2570b4c5a9ff8f342 Mon Sep 17 00:00:00 2001 | |
| From: Gunjan Patel <gunjan@redcomponent.com> | |
| Date: Wed, 22 May 2013 11:32:02 +0530 | |
| Subject: [PATCH 2/3] fix blank array merge to array_values | |
| --- | |
| component/admin/models/product.php | 2 +- | |
| 1 file changed, 1 insertion(+), 1 deletion(-) | |
| diff --git a/component/admin/models/product.php b/component/admin/models/product.php | |
| index 12b2e9c..a6ae30a 100644 | |
| --- a/component/admin/models/product.php | |
| +++ b/component/admin/models/product.php | |
| @@ -82,7 +82,7 @@ public function getData() | |
| // Second pass - get an indent list of the items | |
| $this->_data = JHTML::_('menu.treerecurse', 0, '', array(), $children, max(0, 9)); | |
| - $this->_data = array_merge(array(), $this->_data); | |
| + $this->_data = array_values($this->_data); | |
| } | |
| return $this->_data; | |
| -- | |
| 1.8.1.6 | |
| From 456d87e0fdc3a7941e45bf2540dafc8bb6fc7227 Mon Sep 17 00:00:00 2001 | |
| From: Gunjan Patel <gunjan@redcomponent.com> | |
| Date: Wed, 22 May 2013 11:35:48 +0530 | |
| Subject: [PATCH 3/3] Moved variable asignment in new line | |
| --- | |
| component/admin/models/product.php | 5 +++-- | |
| 1 file changed, 3 insertions(+), 2 deletions(-) | |
| diff --git a/component/admin/models/product.php b/component/admin/models/product.php | |
| index a6ae30a..1a9382a 100644 | |
| --- a/component/admin/models/product.php | |
| +++ b/component/admin/models/product.php | |
| @@ -74,8 +74,9 @@ public function getData() | |
| // First pass - collect children | |
| foreach ($products as $v) | |
| { | |
| - $pt = $v->parent_id = $v->parent; | |
| - $list = @$children[$pt] ? $children[$pt] : array(); | |
| + $pt = $v->parent; | |
| + $v->parent_id = $v->parent; | |
| + $list = @$children[$pt] ? $children[$pt] : array(); | |
| array_push($list, $v); | |
| $children[$pt] = $list; | |
| } | |
| -- | |
| 1.8.1.6 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment