Jump to content

Product condition...


Recommended Posts

Hi... I'm new, and apologise in advance if this question has been answered before...

 

I'm selling electronic components, mostly new, but have new components which can be upto 25 years old...

 

...thus I need to grade these components in more detail than "New", "Used", "Reconditioned".

 

e.g. "New, Old stock - As New", and "New, Old Stock - unused but not perfect"

 

Can this be achieved using the GUI, or do I need to edit config files/database?

 

Also, (for people with more experience than myself) is this a good way to do this... I want to be able to filter products using "Layered Navigation" by these condition attributes as well as product features / attributes.

 

Many thanks in advance...

 

Damian

Link to comment
Share on other sites

You need to extend the product class. Specifically, add a new entry here:

 

 

'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'used', 'refurbished'), '

 

Then also edit admin-products.js, here

				tabs_manager.onLoad('Informations', function(){
					$('#condition').attr('disabled', true);
					$('#condition option[value=refurbished]').removeAttr('selected');
					$('#condition option[value=used]').removeAttr('selected');
				});

And add your value. Then again,  admin themes, products controller, informations.tpl

			<select name="condition" id="condition">
				<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>
				<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>
				<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>
			</select>

and blocklayered.php

				case 'condition':
					$condition_list = array(
						'new' => $this->translateWord('New', (int)$filter['id_lang']),
						'used' => $this->translateWord('Used', (int)$filter['id_lang']),
						'refurbished' => $this->translateWord('Refurbished', (int)$filter['id_lang'])
					);
				preg_match('/^(.*)_([0-9]+|new|used|refurbished|slider)$/', substr($key, 8, strlen($key) - 8), $res);
					if ($res[1] == 'condition' && in_array($value, array('new', 'used', 'refurbished')))
					$condition_array = array(
						'new' => array('name' => $this->l('New'),'nbr' => 0), 
						'used' => array('name' => $this->l('Used'), 'nbr' => 0),
						'refurbished' => array('name' => $this->l('Refurbished'),
						'nbr' => 0)
					);

Phew. I need to make a tutorial :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...