PrestaShop Forums: Edit Features order list - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

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.

NYC

Vous parlez français ? par ici !


Edit Features order list


Edit Features order list

#1 minh

    PrestaShop Apprentice

  • 22 Nov 2008
  • Members
  • PipPip
  • 96 posts

Posted 29 December 2008 - 07:31 PM

Is it possible to edit the order in which the product Features appears in the Data Sheet?

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.

MINH DECOR

- proudly powered by PrestaShop

MINH BLOG

- proudly powered by Wordpress

#2 TropischBruin

    PrestaShop Fanatic

  • 06 Oct 2008
  • Moderators
  • 2198 posts
  • Location:Winkel - The Netherlands

Posted 29 December 2008 - 07:53 PM

There is no Orderdeditor yet in PrestaShop.

I wish there was........ :down:
Norman in 't VeldtModeratorPrestaShopForums
Help PrestaShop, make a donation!

#3 minh

    PrestaShop Apprentice

  • 22 Nov 2008
  • Members
  • PipPip
  • 96 posts

Posted 29 December 2008 - 08:57 PM

By the look of it (from my example above), the order of appearance of Features in the Shop is just haphazard. That seems odd, doesn't it? Is there perhaps some way of controlling this by the order in which one introduces the features in Admin? But it doesn't look like that either...

MINH DECOR

- proudly powered by PrestaShop

MINH BLOG

- proudly powered by Wordpress

#4 michaeld

    PrestaShop Newbie

  • 12 May 2009
  • Members
  • Pip
  • 2 posts

Posted 12 May 2009 - 02:02 PM

This is a quick hack to organize your features(in de same way you organize your categories):

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 belladict

    PrestaShop Apprentice

  • 19 Feb 2009
  • Members
  • PipPip
  • 58 posts

Posted 13 May 2009 - 06:27 PM

Michaeld, thanks so much, the hack works like a charm :)

#6 enigma32

    PrestaShop Apprentice

  • 23 Dec 2009
  • Members
  • PipPip
  • 133 posts

Posted 22 February 2010 - 04:13 AM

can someone help.. using this method in classes/product.php function getAttributesGroups to sort attributes and groups with '##.' prefixes, but unable to strip the numbers for display as im not familiar with this whole 'al.' syntax so i dont know what to change 'name' to to strip it

#7 enigma32

    PrestaShop Apprentice

  • 23 Dec 2009
  • Members
  • PipPip
  • 133 posts

Posted 22 February 2010 - 04:16 AM

nevermind.. 'attribute_name' if anybody else is trying to do this

#8 Benygh

    PrestaShop Apprentice

  • 25 Feb 2010
  • Members
  • PipPip
  • 43 posts

Posted 19 March 2010 - 11:41 PM

From 1266808397:

can someone help.. using this method in classes/product.php function getAttributesGroups to sort attributes and groups with '##.' prefixes, but unable to strip the numbers for display as im not familiar with this whole 'al.' syntax so i dont know what to change 'name' to to strip it


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 Diemux

    PrestaShop Apprentice

  • 17 May 2009
  • Members
  • PipPip
  • 103 posts

Posted 23 April 2010 - 11:17 AM

This no longer works in latest version (1.3.x)

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 shopgirl

    PrestaShop Newbie

  • 08 Jun 2010
  • Members
  • Pip
  • 17 posts

Posted 12 June 2010 - 10:26 PM

Anyone? I too would like this working for version 1.3. Thanks.

#11 justweb

    PrestaShop Apprentice

  • 01 Feb 2008
  • Members
  • PipPip
  • 66 posts

Posted 19 June 2010 - 12:38 PM

Hello,

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 Diemux

    PrestaShop Apprentice

  • 17 May 2009
  • Members
  • PipPip
  • 103 posts

Posted 21 June 2010 - 07:58 AM

Works now in 3.0.1.1!

#13 Benygh

    PrestaShop Apprentice

  • 25 Feb 2010
  • Members
  • PipPip
  • 43 posts

Posted 21 June 2010 - 01:32 PM

what code did u use ?

what file ?! can u explain ?

#14 neastea18

    PrestaShop Apprentice

  • 02 Jul 2010
  • Members
  • PipPip
  • 33 posts

Posted 05 July 2010 - 01:09 PM

I just found another discussion talking about the same problem
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 deniss

    PrestaShop Newbie

  • 15 Jul 2010
  • Members
  • Pip
  • 8 posts

Posted 12 August 2010 - 05:45 AM

Here is the code for the 1.3 version, copy the code and replace the old one if you don't want to make mistake (don't forget to back up the old code if something goes wrong)

http://www.prestasho...racteristiques/
ChiniStore, la boutique de Produit High Tech et Gadgets de marque Chinoise (Tablette PC, MP4...)
ChiniTech, l'actualité Geek et High Tech venue de Chine

#16 mohsart

    PrestaShop Addict

  • 12 Oct 2009
  • Members
  • PipPipPip
  • 507 posts
  • Location:Stockholm, Sweden

Posted 12 October 2010 - 08:24 PM

From 1272017876:

This no longer works in latest version (1.3.x)

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
I'm on 1.4.3 if nothing else is stated. My blog about using PrestaShop http://mohsart-prest...p.blogspot.com/ (I'm a n00b myself, so much is very basic)

NOTE! When I say "change xxx" I usually mean what is described here

My shop: http://mohsart.se

#17 cartcreative

    PrestaShop Apprentice

  • 05 Dec 2010
  • Members
  • PipPip
  • 28 posts

Posted 09 December 2010 - 05:25 AM

Has anybody been able to get this to work on 1.3.2.3 or 1.3.3?

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 5ummer5

    PrestaShop Apprentice

  • 19 Sep 2008
  • Members
  • PipPip
  • 85 posts

Posted 09 December 2010 - 05:14 PM

Hi,

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.
So Cute Accessories!
http://www.socute.co.uk

#19 cartcreative

    PrestaShop Apprentice

  • 05 Dec 2010
  • Members
  • PipPip
  • 28 posts

Posted 11 December 2010 - 04:27 AM

I've managed to get this working on the front end. Has anyone managed to get the ordering to work in the BO? If so, can you share your code, please?

#20 5ummer5

    PrestaShop Apprentice

  • 19 Sep 2008
  • Members
  • PipPip
  • 85 posts

Posted 11 December 2010 - 10:08 AM

Hi,

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!
So Cute Accessories!
http://www.socute.co.uk





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users