ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart Build To Order > Using BTO
  New Posts New Posts RSS Feed - Mass assign default option within a BTO category.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Mass assign default option within a BTO category.

 Post Reply Post Reply
Author
Message
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post Topic: Mass assign default option within a BTO category.
    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.
Back to Top
ProductCart View Drop Down
Admin Group
Admin Group

ProductCart Team

Joined: 01-October-2003
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote ProductCart Quote  Post ReplyReply Direct Link To This Post 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 shopping cart software
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post 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.

Edited by Brett - 23-January-2011 at 10:44am
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post 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:
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.

Edited by Brett - 23-January-2011 at 11:04am
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post 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. 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.