Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

Vous parlez français ? par ici !
Edit Features order list
#1
Posted 29 December 2008 - 07:31 PM
Example: In Admin I have the follow Features availble (in this order):
Height
Width
Depth
Weight
Size
Diameter
Form
Length
When I put in values for Height, Size, Diameter and Form they appear in this order in the Shop:
Size
Height
Form
Diameter
Why? And is it possible to edit this? Btw, using 1.1 Final.
#2
Posted 29 December 2008 - 07:53 PM
I wish there was........ :down:
#3
Posted 29 December 2008 - 08:57 PM
#4
Posted 12 May 2009 - 02:02 PM
Edit file classes/Product.php
Replace:
/*
* Select all features for a given language
*
* @param $id_lang Language id
* @return array Array with feature's data
*/
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
return Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product));
}
With:
/*
* Select all features for a given language
*
* @param $id_lang Language id
* @return array Array with feature's data
*/
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
$result = Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product).'
ORDER BY `name` ASC');
/* Modify SQL result */
$resultsArray = array();
foreach ($result AS $row)
{
$row['name'] = preg_replace('/^[0-9]+./', '', $row['name']);
$resultsArray[] = $row;
}
return $resultsArray;
}
Now your can organize your features by putting the position in front of it, followed by a dot
For example:
01.Feature1
02.Feature2
#5
Posted 13 May 2009 - 06:27 PM
#6
Posted 22 February 2010 - 04:13 AM
#7
Posted 22 February 2010 - 04:16 AM
#8
Posted 19 March 2010 - 11:41 PM
From 1266808397:
u can try this module ...
http://www.presto-ch...der.html#idTab5
it works fine ...
This way doesnt work for me ...
it works for the Categories but doesnt work in features ...
im using persian version of prestashop ...
i think the problem is caused by this but as i said i have no problem with sorting categories with this way ...
i tried english titles and persian both,
#9
Posted 23 April 2010 - 11:17 AM
I use:
/*
* Select all features for a given language
*
* @param $id_lang Language id
* @return array Array with feature's data
*/
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
return Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product).' order by name');
$resultsArray = array();
foreach ($result AS $row)
{
$row['name'] = Product::hideFeaturePosition($row['name']);
$resultsArray[] = $row;
}
return $resultsArray;
}
static public function hideFeaturePosition($name)
{
return preg_replace('/^[0-9]+./', '', $name);
}
But no luck. The numbers stay visible. Weird though as I checked with the categories and that is still using the same code (and does work ;) )
Any idea's?
#10
Posted 12 June 2010 - 10:26 PM
#11
Posted 19 June 2010 - 12:38 PM
don't work for me. i use 1.3 version
The prefix appear and filter order doesn't work...
my code
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
$result = Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product).'
ORDER BY `name` ASC');
/* Modify SQL result */
$resultsArray = array();
foreach ($result AS $row)
{
$row['name'] = preg_replace('/^[0-9]+./', '', $row['name']);
$resultsArray[] = $row;
}
return $resultsArray;
}
help me please...
thx
#12
Posted 21 June 2010 - 07:58 AM
#13
Posted 21 June 2010 - 01:32 PM
what file ?! can u explain ?
#14
Posted 05 July 2010 - 01:09 PM
http://www.prestasho...aracteristiques
However, they had a better UI presentation
by using:
FRUIT.01.Appellation
FRUIT.02.Origine
FRUIT.03….
AUTO.01.Puissance fiscale
AUTO.02.Nombre de portes
AUTO.03….
into:
FRUIT
Origine
Appellation
[…]
AUTO
Puissance fiscale
Nb de portes
[…]
Can someone help? Please
#15
Posted 12 August 2010 - 05:45 AM
http://www.prestasho...racteristiques/
ChiniTech, l'actualité Geek et High Tech venue de Chine
#16
Posted 12 October 2010 - 08:24 PM
From 1272017876:
I use:
/*
* Select all features for a given language
*
* @param $id_lang Language id
* @return array Array with feature's data
*/
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
return Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product).' order by name');
$resultsArray = array();
foreach ($result AS $row)
{
$row['name'] = Product::hideFeaturePosition($row['name']);
$resultsArray[] = $row;
}
return $resultsArray;
}
static public function hideFeaturePosition($name)
{
return preg_replace('/^[0-9]+./', '', $name);
}
But no luck. The numbers stay visible. Weird though as I checked with the categories and that is still using the same code (and does work ;) )
Any idea's?
You didn't change all the code
return Db::getInstance()->ExecuteS(' is still there/Mats
NOTE! When I say "change xxx" I usually mean what is described here
My shop: http://mohsart.se
#17
Posted 09 December 2010 - 05:25 AM
I've tried the code from this thread, as well as the code over on the French thread, and its not stripping out the numbers.
I really don't even need to have the features listed in a custom order, just listed in the order I entered them in!
Can anyone help please?
#18
Posted 09 December 2010 - 05:14 PM
Im using v.1.3.3 and it worked fine for me.
It is just on my localhost at the moment so I hope it doesnt change when I upload it to my main server.
http://www.socute.co.uk
#19
Posted 11 December 2010 - 04:27 AM
#20
Posted 11 December 2010 - 10:08 AM
I think this code will only order the front end and not it the BO. Although im not 100% on that so someone correct me if im wrong!
http://www.socute.co.uk
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












