Jump to content
Sign in to follow this  
Chandra

Option Type Feature v1.6 (for osc 2.2 MS2)

Recommended Posts

Hello,

I receive these error when i add an atribute to a product.

 

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

1136 - Column count doesn't match value count at row 1

 

insert into products_attributes values ('', '8', '2', '0', '0', '+')

 

[TEP STOP]

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

 

I?m sure i make something very stupid, but i can?t find where! :(

 

Thanks.

Share this post


Link to post
Share on other sites

Help

The Option name isn't being displayed in the shopping cart, order confirmation, or confirmation email?

Share this post


Link to post
Share on other sites

:rolleyes: I am trying to set up a site for my wife

 

Using osc 2.2 Milestone 2 and Product Attributes - Option Type Feature v1.6

 

I can?t seem to get it working The Option name isn't being displayed in the shopping cart, order confirmation, or confirmation email? :(

 

I have been working on this for a long time i think my problem is with

 

STEP 3. Update the Product Options to Product Options Values mapping.

 

I just want the user to input there name for Personalizing.

 

Any help will be greatly appreciated

 

Thank you for your time

Share this post


Link to post
Share on other sites

Hi Chandra

 

i have tried installing this option but failed miserably.

 

The code change was no problem but when i tried to modify the database with your sql statement I always get duplicate entries and nothing is added.

 

i have tried this on mysql front and also phpmyadmin so how can I add thes fields to the database if I look at the sql statements teh onlz difference in them is 1 incremented number but the field name is the same, I have posted a few requests about this on this board but everyone seems reluctant to help me.

 

Please can you explain how to add duplicate fields to a database.

 

Cheers

Steve

Share this post


Link to post
Share on other sites
Is there a way to sort the way the options appear, or does it just do it alphabetically by Option name?

I'd also like to know how to order the option. Many thanks!

Share this post


Link to post
Share on other sites

Hey Everyone, this is an awesome contribution by the way. So far I have been able to install it with no major problems except an error I found about not being able to find define TABLE_PRODUCTS_OPTIONS_VALUES. I added the following line to database.php

define('TABLE_PRODUCTS_OPTIONS_VALUES', 'products_options_values');

and this enabled me add attributes. However I still have one problem, when i add items to my shopping cart, the page doesn't display an more. the whole page goes blank. However when I check cart contents, it does display with the chosen options, if I click update cart however the shopping cart page displays blank again.

I installed this on oscommerce-2.2ms2. I am not sure if I need some additional changes in order to make this work. Any assitance on this issue would be greatly appreciated. I am anxious to start using this!!

 

Thanks

Ehi Binitie

Share this post


Link to post
Share on other sites

I have this contribution installed and also added Attribute copier, I get an error message when I try to add new product attribures.

 

The error is similar to this

 

 

1136 - Column count doesn't match value count at row 1

 

insert into products_attributes values ('', '8', '2', '0', '0', '+')

 

[TEP STOP]

 

 

any suggestions on how to fix it?

 

Angie

Share this post


Link to post
Share on other sites

hello

i was wondering if there is a way of getting the list of orders that have a certain attribut and being able to view them also.

Share this post


Link to post
Share on other sites

Hello All,

 

I've installed this contribution. Currently, most of my 500+ products offer five text boxes, and two checkboxes on their info pages. These are correctly sorted on the info pages. However, if the customer logs in after placing a product within the cart, the sort order of these attributes invariably goes awry.

 

Since the five text boxes must sort in proper order to make sense (they compose an enclosure card message), this creates a considerable problem.

 

Is there any way to ensure that these attributes will sort properly, not only on the product info pages, but also within the cart and subsequent email messages?

 

Thanks in advance for any help.

 

Allen

Share this post


Link to post
Share on other sites

Allen,

 

In catalog/product_info.php you added this:

 

//clr 030714 update query to pull option_type
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'  order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
   //clr 030714 add case statement to check option type

 

That line sorts that product options by name or alphabetically. You probably added your options in the order you wanted them displayed, so if you change it to sort by options ID, it will display in the order you entered it.

 

Change the 1st code line from this:

 

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

 

to:

 

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_id");

 

Tracy


God Bless,

Tracy Gibson

Share this post


Link to post
Share on other sites

I am also having the problem that Allen is having.

 

My situation:

 

I have multiple option type text fields per product.

 

When entering multiple products (around three or more) with multiple text fields in the shopping cart the first time when entered, they are fine.

 

When you log out and go back to the shopping cart to see your products and their option type text values, they are displayed out of order by option id.

 

I have checked the "order by" code, and it is set to products_option_id

 

When the email confirmation is generated it also displays the incorrect order, as well as order history when order is submitted.

 

For the life of me, I have spent hours trying to figure out this bug.

 

If anyone has encountered this problem, or see's that it is a problem that is prevelent to the contribution, i would surely like some help or guidance.

 

Please help,

 

max


.:) shadowmaxss (:.

shadowmaxss dot com/portal

I love loaded osc distros

Share this post


Link to post
Share on other sites

Around lines 226-9 of includes/classes/order.php, try changing

        if ($products[$i]['attributes']) {
         $subindex = 0;
         reset($products[$i]['attributes']);
         while (list($option, $value) = each($products[$i]['attributes'])) {

to

        if ($products[$i]['attributes']) {
         $subindex = 0;
         ksort($products[$i]['attributes']);
         reset($products[$i]['attributes']);
         while (list($option, $value) = each($products[$i]['attributes'])) {

Hth,

Matt

Share this post


Link to post
Share on other sites
Around lines 226-9 of includes/classes/order.php, try changing
 ? ? ? ?if ($products[$i]['attributes']) {
? ? ? ? ?$subindex = 0;
? ? ? ? ?reset($products[$i]['attributes']);
? ? ? ? ?while (list($option, $value) = each($products[$i]['attributes'])) {

to

 ? ? ? ?if ($products[$i]['attributes']) {
? ? ? ? ?$subindex = 0;
? ? ? ? ?ksort($products[$i]['attributes']);
? ? ? ? ?reset($products[$i]['attributes']);
? ? ? ? ?while (list($option, $value) = each($products[$i]['attributes'])) {

Hth,

Matt

Hey Matt,

 

First of all, thanks for responding.

 

I tried that snipet of code you suggested. That didn't work either.

 

I still get the option text values showing up out of order when I log off and log back on.

 

This is definately a tricky one.

 

:(

 

well, it's definately a move in the right direction, I see where you are going with it.

 

If you or anyone else has any ideas, I would love to hear them... Or if anyone else is experiencing the same problem, I'd like to feel that I'm not alone.

 

If it were possible, can someone test this with their working site? When I try it, the first order goes through fine, the second time this strategy is implemented, that's when I am experiencing these problems.

 

I beleive it has something to do when the data is pulled from mysql and then placed in the variables assigned in the shopping cart after someone has logged out and logged back in. When the order is first constructed, things are fine when using arrays. but when the data is pulled from the database, it is displayed out of order.

 

Thanks again,

 

Max


.:) shadowmaxss (:.

shadowmaxss dot com/portal

I love loaded osc distros

Share this post


Link to post
Share on other sites

Around lines 33-5 of includes/classes/shopping_cart.php, there is similar code:

            if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

Perhaps adding the ksort here would help:

            if (isset($this->contents[$products_id]['attributes'])) {
             ksort($this->contents[$products_id]['attributes']);
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

Also, around line 55, you might want to change

        $attributes_query = tep_db_query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");

to

        $attributes_query = tep_db_query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "' order by products_options_id");

Also, around lines 102-4, change

        if (is_array($attributes)) {
         reset($attributes);
         while (list($option, $value) = each($attributes)) {

to

        if (is_array($attributes)) {
         ksort($attributes);
         reset($attributes);
         while (list($option, $value) = each($attributes)) {

Note: of the three changes, the middle one is the most likely to matter.

 

Hth,

Matt

Share this post


Link to post
Share on other sites

Excellent! thanks matt... thank you for the insight! So far so good, I have a few more tests to the shopping cart to make sure it is sorting properly and ordering it properly...

 

Now, as for the account_history_info.php, follow below:

 

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
? ?echo ' ? ? ? ? ?<tr>' . "\n" .
? ? ? ? ' ? ? ? ? ? ?<td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
? ? ? ? ' ? ? ? ? ? ?<td class="main" valign="top">' . $order->products[$i]['name'];

? ?if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
? ? ?for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
? ? ? ?echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
? ? ?}
? ?}

 

How would I apply that to this code in account_history_info.php?

To sort the info displayed in account history?

 

Thank you so much for your time and effort,

 

Max

Edited by shadowmaxss

.:) shadowmaxss (:.

shadowmaxss dot com/portal

I love loaded osc distros

Share this post


Link to post
Share on other sites

I would try putting it here:

    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
    for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

Like this:

    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
    ksort($order->products[$i]['attributes']);
    for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

If that doesn't work, look for the attributes query in the query function of class order and add an order by products_options_id to it (probably should do that anyway; I don't think that I posted that yet).

 

Hth,

Matt

Share this post


Link to post
Share on other sites
I just posted Version 1.6 of the Product Attributes - Option Type Feature. You can find it at.

 

http://www.oscommerce.com/community/contributions,160

 

The purpose of this contribution is to allow the use of various option types when setting up product attributes. Originally the contribution included support for Text options. It now also includes support for Radio Buttons and Checkboxes.

 

This page includes a link to a demo store using the contribution http://www.OpenStoreSolutions.com/option_t...ontribution.php

 

Version 1.6 of the contribution is built for osc 2.2 Milestone 2.

 

Cheers,

-Chandra

http://www.OpenStoreSolutions.com

Anyone know how to correct the confirmation email, so the attributes are each on seperate lines?

 

I'm pretty sure it's just a \n somewhere, but I can't figure out where!

 

ie it looks like this now:

 

Products

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

1 x Creat a custom item - you provide the details, we'll print it () = $5.00

A - Custom Store Name: test B - Custom Store Address: safdsd C - Custom Store Phone: dsf Custom Date and Time: blah

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

Sub-Total: $5.00

 

 

I'd like the email to look like this:

 

Products

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

1 x Creat a custom item - you provide the details, we'll print it () = $5.00

A - Custom Store Name: test

B - Custom Store Address: safdsd

C - Custom Store Phone: dsf

Custom Date and Time: blah

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

Sub-Total: $5.00

 

 

Thanks, and great contribution. =)

Share this post


Link to post
Share on other sites

Around line 214 of checkout_process.php, you should see a line that looks like

        $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);

This line is what includes each attribute.

 

Hth,

Matt

Share this post


Link to post
Share on other sites

I am having troubles with sorting my options. I installed Attribute Sort and it was great. I then came up with the need to install Option Type Feature. It is great contribution, but I need to be able to sort my Attributes. Is this possible without having to go in and change all the ids of the atttributes?

Share this post


Link to post
Share on other sites

The two contributions can be used together. You have to merge the lines that each changes. In particular, the Sorter changes the order by clauses to the attribute and option queries. You need to add those changes to the queries that the option type feature provides.

 

Hth,

Matt


Always back up before making changes.

Share this post


Link to post
Share on other sites

uh.. wasn't there an " Order" field in an older version of option type feature?

 

if i look at this osc shop i have, this one has the order field in the "Products Attributes" section... why has it been removed?

 

actually let me go look at it and i'll try to re add it in ;)

Edited by voided

Designrfix.com | Graphic Design Inspiration & Web Design Resources - @designrfix

Share this post


Link to post
Share on other sites

Hi, has anyone tried to add another option type ? I would like to add a bigger textbox, like a comment box, with more lines ... any suggestions please ? Thx a lot.

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  

×