Mass assign default option within a BTO category.
Printed From: ProductCart E-Commerce Solutions
Category: ProductCart Build To Order
Forum Name: Using BTO
Forum Description: Exchange message with other users of ProductCart Build To Order
URL: https://forum.productcart.com/forum_posts.asp?TID=4264
Printed Date: 21-November-2024 at 2:08pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Mass assign default option within a BTO category.
Posted By: Brett
Subject: Mass assign default option within a BTO category.
Date Posted: 20-January-2011 at 4:29pm
I think I might be doing this wrong. I used BTO Products > Update Multiple BTO Products > Assign/Remove Products & Items and Update Category Settings.
I used the first one to assign a new BTO category to multiple BTO Products and then I used Update Category Settings to set the display type, to make the category required, to show product description, and to assign config settings for the category.
However, I am unable to assign a default option to the category through these menus. This means no option is selected by default, which isn't a huge deal since the javascript catches a required category with no options, but it is a hindrance since it will slow customers down and it might cost a few sales.
I will have to either manually edit each BTO Product to assign a default option for this category, or edit groups of BTO Products who's configuration settings I will then be able to assign to a few other products. Either way I'm going to have to do quite a bit of extra work.
Is there an easy way to set a default option for a bto item category among multiple products? I'm sure there is and I will look into the code now, but it would be great if someone else already figured this out.
|
Replies:
Posted By: ProductCart
Date Posted: 21-January-2011 at 3:21am
Hi Brett,
We understand the issue. The "Update Category Settings" doesn't allow you to set a default because it cannot make assumptions on which items have been assigned to the BTO product.
The interface that allows you to add multiple items to N BTO products, however, could include that feature.
So, this is a feature change that we can consider for a future version.
In the meantime, the fastest way to address this is probably to edit the configSpec_products table in the store database. You will see the cdefault field: that's the one that defines whether that particular product is the default product.
We hope this helps!
------------- The ProductCart Team
Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software
|
Posted By: Brett
Date Posted: 21-January-2011 at 6:59am
That saves me time looking for the table to edit. I think I'll just edit the asp file so I don't have to manually change the database each time I want to do this. Should be a fairly trivial script, and I will upload here when I'm done (probably a week since I'm not currently at the office)
|
Posted By: Brett
Date Posted: 23-January-2011 at 10:38am
Ok, I think I got this working, at least for my purposes:
on pcadmin/AddRmvBTOItemMulti4.asp
Line 163 add:
<th align="center" nowrap>Default</th>
Change all the colspans to 6 instead of 5 since we're adding a column.
Line 195 add:
<td nowrap align="center"><input type="radio" name="setDefault" value="<%=iCnt%>"></td>
Lines 65-69 add:
if cint(request("setDefault"))=i then
setDefault=1
else
setDefault=0
end if
Line 105 change:
&pcv_WPrice& ",0," & pcv_showInfo
to:
&pcv_WPrice& "," & setDefault & "," & pcv_showInfo
Line 108 change:
",Wprice=" & pcv_WPrice & " WHERE specProduct="
to:
",Wprice=" & pcv_WPrice & ",cdefault=" & setDefault & " WHERE specProduct="
|
The only issue would arise when you're trying to add one or two options to a product and then you want to set one of them to default, when the product already has a default option that was already assigned to it. In this instance, it might try to add two separate options as default. Looking into this now.
|
Posted By: Brett
Date Posted: 23-January-2011 at 10:43am
I'm considering adding this query:
query="UPDATE configSpec_products SET cdefault=0 WHERE specProduct=" & pcArr1(j) & " AND configProduct=" & pcv_configPrd & " AND cdefault=1;"
|
Before:
query="SELECT configProduct FROM configSpec_products WHERE specProduct=" & pcArr1(j) & " AND configProduct=" & pcv_configPrd & ";"
|
I think that would clear all defaults for that product, preventing multiple defaults.
|
Posted By: Brett
Date Posted: 23-January-2011 at 11:00am
Got it, the query that I needed to add was:
query="UPDATE configSpec_products SET cdefault=0 WHERE specProduct=" & pcArr1(j) & " AND configProductCategory=" & pcv_idcategory & ";"
set rstemp=connTemp.execute(query)
set rstemp=nothing
|
That clears all defaults for the category you're setting so you can set new defaults. There should probably be a way to NOT set a new default, but eh...
In case anyone wants the complete updated asp file, here it is:
uploads/1159/AddRmvBTOItemsMulti4.zip - AddRmvBTOItemsMulti4.zip
This will add a new field to the page, allowing you to set a default when you add bto items to multiple bto products. It will, however, clear your previous defaults, so I'd advise that if you want to keep your current default, you re-add it to the bto products so you can select it as default when adding it.
|
Posted By: Brett
Date Posted: 24-January-2011 at 8:34am
Here's an updated version of the file which addresses the issue of having to re-set the defaults. The problem nearly solved itself. Since the radio buttons on AddRmvBTOItemsMulti4.asp are all deselected by default, I modified it so that if no radios are selected, then the previous default will not be changed. However, if one of the radios is selected, then the previous default will be cleared and the new default added. It only needed one if statement. Here is the updated file. No changes besides the ones listed in this thread have been made to the file. A diff compare on the file against the latest version of the file should show the exact changes made. uploads/1159/AddRmvBTOItemsMulti4_2.zip - AddRmvBTOItemsMulti4_2.zip
This updated file allows you to set the default option when assigning BTO item options to a BTO group across multiple products.
|
|