Forums / Setting Up Categories, Products, Attributes / Adding "Condition" drop down menu to new product listing form in Admin

Adding "Condition" drop down menu to new product listing form in Admin

Views: 2,317

Results 1 to 7 of 7
26 May 2014, 4:59 PM
#1
Join Date:
Oct 2010
Posts:
12
Plugin Contributions:
0

Adding "Condition" drop down menu to new product listing form in Admin

Hello All,:cool:

I am currently using Zencart v1.3.9h and it was installed as a new install.

Os = Windows 7 Ultimate
PHP = phpMyAdmin
MySQL = MySQL 5.1
Addons = Google Merchant Feeder

Other than customizing my colors and stylesheet, the only other customization I have done is the addition of the social media sharing buttons, however this was not done with a zc addon.

Website link: http://respawnedelectronix.com

I have done an exhaustive search here and found 1 thread which was similar to what I am trying to do. Here is the link:

https://www.zen-cart.com/showthread.php?132042-Condition-Attribute&highlight=google+merchant+center+configuration+default+condition

We sell products that are new, refurbished & used. What I would like to do is have a dropdown box in the new products form of the Zencart admin when adding a new product to denote each product condition. This would be similar to the current dropdown box that is there by default for Taxable goods.

In the ZC link above it mentions the files that need to be edited to be:

admin/includes/modules/product/collect_info.php to add/display the condition option
admin/includes/modules/update_product.php to enter the info into the database

but, the thread does not go any further to explain the specifics of the edit that is needed.

Would this new condition designation, when adding a new product, be reflected in Google Merchant Center feed upload?

I was hoping that someone might be able to shed some light on this.

Thank you in advance for your time.

Mike Caruso
Electronics Technician
Respawned Electronix

26 May 2014, 8:36 PM
#2
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Adding "Condition" drop down menu to new product listing form in Admin

In the ZC link above it mentions the files that need to be edited to be:

admin/includes/modules/product/collect_info.php to add/display the condition option
admin/includes/modules/update_product.php to enter the info into the database

but, the thread does not go any further to explain the specifics of the edit that is needed.

Would this new condition designation, when adding a new product, be reflected in Google Merchant Center feed upload?

You would need to edit both files and add products_condition to the mysql database.

I defaulted mine to NEW about 95% of my products are new....

`products_condition` varchar(15) NOT NULL DEFAULT 'NEW'

As for editing the files, pick something similar, like products_module and duplicate it thought out the code.
admin/includes/modules/product/collect_info.php

 'products_condition' => '',

-----------------------------------------------

products_date_available, p.products_status, p.products_tax_class_id,
                                      p.manufacturers_id, p.products_condition,

------------------------------

          <tr>
            <td class="main"><?php echo TEXT_PRODUCTS_CONDITION; ?></td>
            <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_condition', $pInfo->products_condition, zen_set_field_length(TABLE_PRODUCTS, 'products_condition')); ?></td>
          </tr>
-------------------------------------

then on admin/includes/modules/update_product.php to set the option into the database...

'products_condition' => zen_db_prepare_input($_POST['products_condition']),

this is just to setup a from fill box, a drop-down would be more work.
This is not a full set of code, but something to point you in the right direction.

Dave
Always forward thinking... Lost my mind!

28 May 2014, 2:09 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: Adding "Condition" drop down menu to new product listing form in Admin

davewest:

This is not a full set of code, but something to point you in the right direction.

I'll just add to this: you forgot about admin/includes/modules/copy_to_confirm.php and admin/includes/modules/update_product.php - those files should be edited as well.

My site - Pro ZC Help
My portfolio | My plugins

28 May 2014, 3:07 PM
#4
Join Date:
Oct 2010
Posts:
12
Plugin Contributions:
0

Re: Adding "Condition" drop down menu to new product listing form in Admin

Thanks guys. I really appreciate your help.

I will give that a try. If I get it accomplished I will post the specifics here so it may help someone else.

I am wondering, however if there is not an easier way to accomplish this differently.

Is it possible to upload two feeds to Google via the merchant center?

One for refurbished products with a designated Google taxonomy, and another for New products with a entirely different Google taxonomy ?

That would eliminate the need to re-code.

Thank you again for your time.

Sincerely,
Mike Caruso
Electronics Technician
Respawned Electronix

28 May 2014, 3:50 PM
#5
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: Adding "Condition" drop down menu to new product listing form in Admin

So, what's the primary purpose of the condition field? Google Merchant Feed or having additional information?

You can take a look at this module to see how to add additional fields in the product's table - just see which files are affected. It's been explained numerous times in the forum so I won't go over it step by step, sorry.

As for doing two different feeds - I'm honestly not sure if there's a different or simpler approach. Personally, I believe it would be simpler to add the new field (it usually takes around 5-10 minutes - it's not at all complex as it may seem at first) and then add a simple if-else statement in the googlefroogle.php file to determine the taxonomy based on that field...

My site - Pro ZC Help
My portfolio | My plugins

28 May 2014, 5:06 PM
#6
Join Date:
Oct 2010
Posts:
12
Plugin Contributions:
0

Re: Adding "Condition" drop down menu to new product listing form in Admin

Hello Balihr,

The primary purpose is the Google Merchant Feed accuracy.

We sell Xbox 360 Consoles which are reballed, or refurbished if you will. We have added a line of customizable Coffee Mugs which are always sold new. I have noticed in the Google Merchant feed that all products are shown as refurbished as designated in the Google Merchant Feed configuration via the Admin.

I am trying to have the feed show new when the product is new, and refurbished when the product is refurbished, so as not to have my feed booted by google and also so the customer sees a more accurate listing in google.

I was hoping that a condition designation when creating a product through the ZC admin would do that for us.

It may be necessary to hand edit the upload, I am not sure.

Thanks again for your help.

Sincerely, Mike C.

28 May 2014, 7:04 PM
#7
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: Adding "Condition" drop down menu to new product listing form in Admin

Yeah, then definitely what I described in the previous post. At least that's how I would do it, but if anyone here knows of a better approach, I'd be happy if he/she would correct me.

My idea:

  • add a new field in the products table
  • edit googlefroogle.php (in your site's root) and add an if-else statement to determine which condition is being set. Also, find a line that determines taxonomy and add another if-else statement to define correct category (I'll make a wild guess and say xbox isn't in the same category as coffee mugs :smile: )

Although... There might be a bit simpler approach. You'll probably have the consoles in one category and coffee mugs in another. I'm assuming ALL consoles are refurbished (you're not offering new ones). In that case, you would only have to edit the googlefroogle.php file and define condition and taxonomy based on master_categories_id (which you would have to add in the sql query as it's not selected by default).

My site - Pro ZC Help
My portfolio | My plugins