Jump to content
Sign in to follow this  
xezol

Category Style Upload Feature

Recommended Posts

My site is:

 

All Things For Home

 

We sell home accessories. Right now focusing on Mirrors and Lamps. We carry over 1000 mirrors. I am using Easy Populate to put the products on-line but each mirrors may be in 3 to 6 difference categories.

 

I have them listed by Price, Size, and Shape. And then again at the next level. I.e. is Rectangle, you can then search again by Price and Size.

 

So for each item I have six lines in Excel for Easy Populate.

 

PRICE - $126 To $200

SHAPE - Rectangle PRICE - $126 To $200

SHAPE - Rectangle

SHAPE - Rectangle SIZE - 25" To 36" W/H

SIZE - 25" To 36" W/H

 

When I change a price or find out the size is wrong or whatever I have to go through and change all of the categories to match the new info. Plus I have to go and delete them out of the old categories, since just changing them would put the item in both.

 

What I want is an easy populate style contribution where there would be 3 columns. Price, Size, and Shape. Each product would just have one line.

 

Say it was $135.00, 30x40, Rectangle.

 

On upload this new contrib would first delete all old listings, then replace with new. Because of the price it would place this item in PRICE - $126 To $250, SIZE - 37" to 48" W/H, and SHAPE - Rectangle.

 

And also in sub-categories in all of these level 1 categories. I.e. PRICE - $126 To $250, cat 2 SIZE, and also PRICE - $126 To $250, cat 2 SHAPE.

 

Clear??

 

So the shortcut being that I would just have 1 line to deal with in excel instead of 6+ per item and the contrib would be doing the work so I wouldn't be messing up.

 

Charles

Edited by Johnson

Share this post


Link to post
Share on other sites

Wouldn't it be better to actually have these characteristics for the mirrors setup as attributes and implement attribute search, possibly with additional shortcuts to execute a particular search.

This way, they'd just be one line in easy populate with attributes supported.

 

Just an idea, but it would certainly be more extensible, eg should you want to add for instance kind of frame (wood/metal), color of frame etc


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
Wouldn't it be better to actually have these characteristics for the mirrors setup as attributes and implement attribute search, possibly with additional shortcuts to execute a particular search.

 

If I did this wouldn't these attributes show up as selectable pull downs on the products pages? That doesn't seem professional at all.

Share this post


Link to post
Share on other sites

The real problem is that Easy Populate does not handle "linked" products between multiple categories.

 

You would have to come up with an alternate solution. In my case I used a MySQL script to link hundreds of products en masse.

The problem was that I had to proof my changes and correct the occasional issue.

 

HTH,

Robert

Share this post


Link to post
Share on other sites
If I did this wouldn't these attributes show up as selectable pull downs on the products pages? That doesn't seem professional at all.

If it's an option with multiple values, eg suppose you have the same mirror in different sizes .. yes.

If however there is only one value, you could code around it to avoid this, or even better, check out the static attributes contribution. Basically declare an attribute as static and it behaves as a characteristic, no dropdowns or anything.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
The real problem is that Easy Populate does not handle "linked" products between multiple categories.

 

You would have to come up with an alternate solution. In my case I used a MySQL script to link hundreds of products en masse.

The problem was that I had to proof my changes and correct the occasional issue.

 

HTH,

Robert

I agree with the EP limitation, but with the examples given, I think manually setting up and maintaining categories and worse, duplicating products all over is a shortsighted solution leading to a maintenance nightmare.

But maybe that is just my biased view being a purist and coder at heart :o

 

Anyhow, just my opinion, no need to follow my advise. I guess, you have to weight the pro's and cons and see which solution you feel most comfortable with now and in the long run.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
I agree with the EP limitation, but with the examples given, I think manually setting up and maintaining categories and worse, duplicating products all over is a shortsighted solution leading to a maintenance nightmare.

But maybe that is just my biased view being a purist and coder at heart  :o

 

I tried this idea. Couple of problems:

 

1) If I change attributes. Like for a price change that puts the product in a different attribute level. From $125 and under to $125 to $200. When I re-upload the old attribute is still there. I would have to go into the system and delete it out everytime. Not an easy thing.

 

2) I'm not a coder and to do the search I would only want the search to appear on the one category page and only contain the attributes that deal with mirrors.

Share this post


Link to post
Share on other sites

So instead of attributes I have created 3 new fields via NewFields contribution.

Width, Height, and Shape.

 

I was able to have a friend do the width/height search but now they have no more time for me. I still need some help on the Shape.

 

I put it as a field in product info. Which was probably wrong because I want this selected via a pull-down menu. I messed with the general.php and and am able to get a pull down with the fields. But it is everything, not just 1 of each option.

 

See here:

 

http://www.allthingsforhome.com/advanced_search2.php

 

The min/max size works. But the shapes does nothing. If anyone has any time to work on this I am willing to pay. It is very important to my company.

 

What I am looking for is to make the shape field into a pull down search with only the options I want. Then to create a search that only looks in the mirrors category.

 

Please someone help me,

Charles

Edited by Johnson

Share this post


Link to post
Share on other sites

to get the dropdown list correctly, you probably are just missing distinct in your select statement, so it becomes

 

select distinct ...<remainder of your current statement>

 

can you paste the new code you put in general.php, from there it will be clear what to add to your advanced search as criteria to make it work.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
to get the dropdown list correctly, you probably are just missing distinct in your select statement, so it becomes

 

select distinct ...<remainder of your current statement>

 

can you paste the new code you put in general.php, from there it will be clear what to add to your advanced search as criteria to make it work.

 

 function tep_get_shape($shape_array = '') {
   if (!is_array($shape_array)) $shape_array = array();

   $shape_query = tep_db_query("select distinct products_shape from " . TABLE_PRODUCTS . " order by products_shape");
   while ($shape = tep_db_fetch_array($shape_query)) {
     $shape_array[] = array('text' => $shape['products_shape']);
   }

   return $shape_array;
 }

 

So now it does only pull 1 of each. Is there a way to do this so it only pulls the shape field of products in one category? id 324. As that is the only one with this field.

Share this post


Link to post
Share on other sites
 function tep_get_shape($shape_array = '') {
? ?if (!is_array($shape_array)) $shape_array = array();

? ?$shape_query = tep_db_query("select distinct products_shape from " . TABLE_PRODUCTS . " order by products_shape");
? ?while ($shape = tep_db_fetch_array($shape_query)) {
? ? ?$shape_array[] = array('text' => $shape['products_shape']);
? ?}

? ?return $shape_array;
?}

 

So now it does only pull 1 of each. Is there a way to do this so it only pulls the shape field of products in one category? id 324. As that is the only one with this field.

 

Although it now only pulls one of each, doing a search on the field doesn't do anything. Meaning the results don't seem to take the field into account at all.

Share this post


Link to post
Share on other sites

To add this to the search

Find

  if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
   $where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
 }

 

Add below

  if (isset($HTTP_GET_VARS['product_shape']) && tep_not_null($HTTP_GET_VARS['product_shape'])) {
   $where_str .= " and product_shape = '" . $HTTP_GET_VARS['product_shape'] . "'";
 }

 

yes, you can restrict it to a category but there is no need to make the query more complex as you said it is only used for this category.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
To add this to the search

Find

 ?if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
? ?$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
?}

 

Add below

 ?if (isset($HTTP_GET_VARS['product_shape']) && tep_not_null($HTTP_GET_VARS['product_shape'])) {
? ?$where_str .= " and product_shape = '" . $HTTP_GET_VARS['product_shape'] . "'";
?}

 

yes, you can restrict it to a category but there is no need to make the query more complex as you said it is only used for this category.

 

http://www.allthingsforhome.com/mirror_sea...o=500&x=64&y=12

 

Added your code to the results but it doesn't appear to be passed on at all from the advanced search page.

 

&product_shape=&

Edited by xezol

Share this post


Link to post
Share on other sites

If I go into the URL and put say arch in so it's

 

&product_shape=arch

 

I get this error:

 

1054 - Unknown column 'p.product_shape' in 'where clause'

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '324' or p2c.categories_id = '375' or p2c.categories_id = '325' or p2c.categories_id = '390' or p2c.categories_id = '391' or p2c.categories_id = '392' or p2c.categories_id = '393' or p2c.categories_id = '394' or p2c.categories_id = '397' or p2c.categories_id = '398' or p2c.categories_id = '400' or p2c.categories_id = '399' or p2c.categories_id = '326' or p2c.categories_id = '327' or p2c.categories_id = '328' or p2c.categories_id = '329' or p2c.categories_id = '330' or p2c.categories_id = '331' or p2c.categories_id = '380' or p2c.categories_id = '378' or p2c.categories_id = '402' or p2c.categories_id = '409' or p2c.categories_id = '403' or p2c.categories_id = '408' or p2c.categories_id = '405' or p2c.categories_id = '406' or p2c.categories_id = '407' or p2c.categories_id = '410' or p2c.categories_id = '411' or p2c.categories_id = '412' or p2c.categories_id = '421' or p2c.categories_id = '379' or p2c.categories_id = '376' or p2c.categories_id = '422' or p2c.categories_id = '415' or p2c.categories_id = '416' or p2c.categories_id = '414' or p2c.categories_id = '413' or p2c.categories_id = '420') and p.product_shape = '0' and ((pd.products_name like '%red%' or p.products_model like '%red%' or m.manufacturers_name like '%red%' or pd.products_description like '%red%') )

Edited by xezol

Share this post


Link to post
Share on other sites
If I go into the URL and put say arch in so it's

 

&product_shape=arch

 

Now I have it that it works if I put the shape into the URL directly, but the parameter is not passed via mirror_search.php page.

Share this post


Link to post
Share on other sites

the code that you build to create the shape dropdown is not working correctly.

You also have to put the shape array into the option value attribute currently they are all blank and all set as selected, which is also incorrect.

there is tep_pulldown menu function that you can use to make things easier.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
the code that you build to create the shape dropdown is not working correctly.

You also have to put the shape array into the option value attribute currently they are all blank and all set as selected, which is also incorrect.

there is tep_pulldown menu function that you can use to make things easier.

 

This is the code for the general function

 

  function tep_get_shape($shape_array = '') {
   if (!is_array($shape_array)) $shape_array = array();

   $shape_query = tep_db_query("select distinct products_shape from " . TABLE_PRODUCTS . " order by products_shape");
   while ($shape = tep_db_fetch_array($shape_query)) {
     $shape_array[] = array('text' => $shape['products_shape']);
   }

   return $shape_array;
 }

 

 

And this is the code in the search

 

              <tr>
               <td class="fieldKey"><?php echo ENTRY_SHAPE; ?></td>
               <td class="fieldValue"><?php echo tep_draw_pull_down_menu('product_shape', tep_get_shape(array(array('text' => TEXT_ALL_SHAPES)))); ?></td>
             </tr>

 

I only know enough to fake it so all of your help is greatly appreciated.

Share this post


Link to post
Share on other sites

You have to have id text pairs so make the following change in general.php function

 

     $shape_array[] = array('id' => $shape['products_shape'],
                                        'text' => $shape['products_shape']);

 

In your search page the id for all shapes is not set but result is '' which is OK. To make it explicit you could at 'id' => '',

in the same way as above.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
 ? ? $shape_array[] = array('id' => $shape['products_shape'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => $shape['products_shape']);

 

Again, thanks so much for your help. Only real thing now is error messages. It comes up with a message if you only select shape, and it comes up with an error if you only select the size high/low fields.

 

  if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo 

DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) || (sto.length < 1)) && ((sfrom == '') || (sfrom.length < 1)) && ((sto == 

'') || (sto.length < 1)) ) {
   error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
   error_field = document.mirror_search.keywords;
   error_found = true;
 }

 

I thought I had the size (sto, sfrom) covered but it still errors if that is the only inputs entered.

 

Charles

Share this post


Link to post
Share on other sites

suggest you rearrange the if statement to have the checks for each of the fields on one line as well as the different brackets aligned.

You'll see the pattern and where you made error in the (sto.length)

 

For the shape, you need to add a similar check like you've got for keywords


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
suggest you rearrange the if statement to have the checks for each of the fields on one line as well as the different brackets aligned.

You'll see the pattern and where you made error in the (sto.length)

 

For the shape, you need to add a similar check like you've got for keywords

 

function check_form() {
 var error_message = "<?php echo JS_ERROR; ?>";
 var error_found = false;
 var error_field;
 var keywords = document.mirror_search.keywords.value;
 var pfrom = document.mirror_search.pfrom.value;
 var pto = document.mirror_search.pto.value;
 var pfrom_float;
 var pto_float;

 if ( ((keywords == '') || (keywords.length < 1)) 
 && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) 
 && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) 
 && ((pfrom == '') || (pfrom.length < 1))
 && ((pto == '') || (pto.length < 1))
 && ((sfrom == '') || (sfrom.length < 1)) 
 && ((sto == '') || (sto.length < 1)) ) 
{
   error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
   error_field = document.mirror_search.keywords;
   error_found = true;
 }

 if (pfrom.length > 0) {
   pfrom_float = parseFloat(pfrom);
   if (isNaN(pfrom_float)) {
     error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
     error_field = document.mirror_search.pfrom;
     error_found = true;
   }
 } else {
   pfrom_float = 0;
 }

 if (pto.length > 0) {
   pto_float = parseFloat(pto);
   if (isNaN(pto_float)) {
     error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
     error_field = document.mirror_search.pto;
     error_found = true;
   }
 } else {
   pto_float = 0;
 }

 if ( (pfrom.length > 0) && (pto.length > 0) ) {
   if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
     error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
     error_field = document.mirror_search.pto;
     error_found = true;
   }
 }

 if (error_found == true) {
   alert(error_message);
   error_field.focus();
   return false;
 } else {
   RemoveFormatString(document.mirror_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
   RemoveFormatString(document.mirror_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
   return true;
 }
}

 

I can't see what the problem is. I need to add the Shape and the sfrom and sto so that they can be the only things in the search and it is valid. Right now if I only use them I get the error and it takes me to advanced_search instead of my mirror_search pages.

 

Thanks,

Charles

Share this post


Link to post
Share on other sites

My bad. I should of been looking in the results page. Got errors to show up on the mirrors search now and not the advanced.

 

Still can't get the errors to work though for my new fields.

 

  if ( (isset($HTTP_GET_VARS['keywords']) 
&& empty($HTTP_GET_VARS['keywords'])) 
&& (isset($HTTP_GET_VARS['dfrom']) 
&& (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) 
&& (isset($HTTP_GET_VARS['dto']) 
&& (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) 
&& (empty($HTTP_GET_VARS['product_shape']))
&& (isset($HTTP_GET_VARS['sfrom']) 
&& !is_numeric($HTTP_GET_VARS['sfrom'])) 
&& (isset($HTTP_GET_VARS['sto']) 
&& !is_numeric($HTTP_GET_VARS['sto'])) 
&& (isset($HTTP_GET_VARS['pfrom']) 
&& !is_numeric($HTTP_GET_VARS['pfrom'])) 
&& (isset($HTTP_GET_VARS['pto']) 
&& !is_numeric($HTTP_GET_VARS['pto'])) ) {
   $error = true;

Share this post


Link to post
Share on other sites

GOT IT!

 

Missing one little line

 

  if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords) && empty($product_shape) && empty($sfrom) && empty($sto)) {
   $error = true;

Share this post


Link to post
Share on other sites

congratulations !

So you're pretty much done then with the mirror tweaks ?


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
congratulations !

So you're pretty much done then with the mirror tweaks ?

 

One more problem right now lol.

 

I want to put some of this functionality directly on the mirrors page.

 

So I added this to index.php as a test.

 

<?php if 
($categories['categories_id'] == 324) { ?> MIRROR PAGE
<?php } ?>

 

Where MIRROR PAGE would then be an include for a modified mirror_search or something along the lines of the manufacturer drop down that appears on the top of the index pages.

 

You can see the search completed here: http://www.allthingsforhome.com/mirror_sea...tegories_id=324

 

It is linked directly from products descriptions on the mirror category page.

Edited by xezol

Share this post


Link to post
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
Sign in to follow this  

×