Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Attribute Controller: Update with new settings/prices, DO NOT add new ones?

Attribute Controller: Update with new settings/prices, DO NOT add new ones?

Views: 2,352

Results 1 to 6 of 6
9 Jul 2010, 8:25 PM
#1
eztx avatar

eztx

New Zenner

Join Date:
Jul 2010
Posts:
5
Plugin Contributions:
0

Attribute Controller: Update with new settings/prices, DO NOT add new ones?

In the store I'm maintaining, I need to change the extra cost of different sizes of clothing. Although the prices that correspond to the different sizes of each product remain the same for all of the products in that category, each product has a different range of sizes.

What I want to do is edit the product in that category with the largest range of sizes with the correct size pricing, then use the "copy to category" feature to update the size pricing for the rest of the products of that category. The problem is, there is no option on the "copy to category" page to do this. The closest option on that page, "Update with new settings/prices, then add new ones" won't work because I do NOT want to add extra sizes to products that shouldn't have them.

All I would need is an "Update with new settings/prices, and DO NOT add new ones" option and everything would work out perfectly. I was going to try to add this option by editing attributes_controller.php but I wanted to see if anyone else had a solution already. If I end up writing the solution I'll be sure to post it here.

Much appreciated

13 Jul 2010, 5:44 PM
#2
eztx avatar

eztx

New Zenner

Join Date:
Jul 2010
Posts:
5
Plugin Contributions:
0

Re: Attribute Controller: Update with new settings/prices, DO NOT add new ones?

bump

I tried making a mod of the attributes_controller on my own but I'm honestly not sure where to start.

I see this:

// attributes copy to product
case 'update_attributes_copy_to_product':
$copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
$copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
$copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
zen_copy_products_attributes($_POST['products_filter'], $_POST['products_update_id']);
$_GET['action']= '';
$products_filter = $_POST['products_update_id'];
zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
break;

// attributes copy to category
case 'update_attributes_copy_to_category':
$copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
$copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
$copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
if ($_POST['categories_update_id'] == '') {
$messageStack->add_session(WARNING_PRODUCT_COPY_TO_CATEGORY_NONE . ' ID#' . $_POST['products_filter'], 'warning');
} else {
$copy_to_category = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $_POST['categories_update_id'] . "'");
while (!$copy_to_category->EOF) {
zen_copy_products_attributes($_POST['products_filter'], $copy_to_category->fields['products_id']);
$copy_to_category->MoveNext();
}
}
$_GET['action']= '';
$products_filter = $_POST['products_filter'];
zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
break;

}

}

Anyone have an idea to get started? If I could even change the option so that it doesn't add new attributes it would save me so much time.
Thanks.

13 Jul 2010, 8:25 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Attribute Controller: Update with new settings/prices, DO NOT add new ones?

I am not sure how many Categories of Products that you have are, but at the top of the Attributes Controller, when looking at a Product with Attributes, is the button to Copy to Category ... this is made to copy the Attributes from the displayed Product to a Category and all of the Products in it ...

Would that help you manage this issue? :unsure:

19 Apr 2011, 8:42 AM
#4
slf3 avatar

slf3

New Zenner

Join Date:
Apr 2011
Location:
England
Posts:
16
Plugin Contributions:
0

Re: Attribute Controller: Update with new settings/prices, DO NOT add new ones?

Hi eztx

Did you ever solve this? We also need to have an ATTRIBUTE COPY AND UPDATE that does not add new attributes to the other products in the category.

It can't be that rare. Our products each come in several sizes, and are grouped by category. However not all products in the category come in all of the sizes.

So for example category A will have 5 products, and each product will be available in from 1 to 4 sizes.

Category A
Product 1 sizes S M L XL
Product 2 sizes M L XL
Product 3 sizes S M L
Product 4 sizes S M L XL
Product 5 sizes XL

We'd like to update product 1 prices (ie any product that is available in all 4 sizes), then use a new "Update with new settings/prices, DO NOT add new ones" function to update all of the prices on the other products in the category, but without adding the new sizes to the other products.

We currently have to do it manually, but with around 400 categories, 1000+ products, and with from 1 to 12 sizes per product, it is a time consuming job.

19 Apr 2011, 12:05 PM
#5
slf3 avatar

slf3

New Zenner

Join Date:
Apr 2011
Location:
England
Posts:
16
Plugin Contributions:
0

Re: Attribute Controller: Update with new settings/prices, DO NOT add new ones?

Further to previous post, and if anyone is reading this :smile: , then I guess there are two places that may need changing.

  1. ATTRIBUTES CONTROLLER

/admin/attributes_controller.php
which calls...

  1. DATABASE ACCESS

/admin/includes/functions/general.php
and specifically the function 'zen_copy_products_attributes'

But I think this level of SQL and PHP is beyond me. Also messing about with either of these two files could do quite a bit of damage!

Any experts out there who can help.

4 May 2011, 11:32 AM
#6
slf3 avatar

slf3

New Zenner

Join Date:
Apr 2011
Location:
England
Posts:
16
Plugin Contributions:
0

Re: Attribute Controller: Update with new settings/prices, DO NOT add new ones?

bump :smile: