Latest News: (loading..)
kymation

[Addon] Shopping List

28 posts in this topic

This addon provides a Shopping List that your customers can use to keep track of items that they want to reorder periodically, or that they want to save for a future order. It was designed for an osCommerce store that sells consumables, but it works with any type of business that wants to increase repeat business.

Your customers can create multiple shopping lists, up to a maximum that you set in your store's Admin. Products can be added to a shopping list from a product page or from the shopping cart. Any product in a shopping list can be added to the cart, or the whole list can be added at one time. There are a full set of features that allow your customer to create, modify, delete, and view their shopping lists.


The tooltips used here are a backport from Bootstrap. I'll modify this to use the real Bootstrap tooltips when osCommerce switches to Bootstrap.

 

Screenshots:

Add a product to an existing shopping list.

Add a product to a new shopping list - step one.

Add a product to a new shopping list - step two.

After a product is added to a shopping list (confirmation)

The shopping list page.

 

Here's the code.

 

Regards

Jim

Edited by kymation
Tsimi, bruyndoncx, frankl and 2 others like this

Share this post


Link to post
Share on other sites

@@kymation Hi Jim,

 

Looks good - Just an observation from reading the install instructions - Support thread and bug reports point to your Superfish contribution threads.

 

Thanks :)

Share this post


Link to post
Share on other sites

@@Tsimi  Updated; thanks for the reminder.

 

@@Mort-lemur  Fixed and a new version uploaded. Thanks for the bug report.

 

Now what else did I forget?

 

Regards

Jim

Share this post


Link to post
Share on other sites

@@kymation Jim

 

Nice module but think i have found a bug?

 

if you update qty in the shopping list it does not appear to update the table (if I manually alter the qty in the table it reads the correct qty) just the update does not appear to do anything, also the products_name is not being populated in the shopping_lists_products table.

Share this post


Link to post
Share on other sites

The update form seems to have the wrong action attached. I'll fix that. I'll take a look at the products_name field as well.

 

Thanks for the bug reports.

 

Regards

Jim

Share this post


Link to post
Share on other sites

@kymation Jim

 

A couple of issues I have encountered while testing this add-on on OS 2.3.4 on my localhost machine, with SSL disabled.

 

When you are on the product_info.php page, and try to add a product to the shopping list with SSL disabled, you are redirected to https:// which doesn't exist if SSL is off.

 

I had to change 'SSL' to 'NONSSL' to make it work

 

    function dialog_add_to_list( $self_filename, $products_id, $languages_id=1, $currencies ) {

      $dialog = '    <div id="add_new_dialog" title="' . SUBTITLE_PRODUCT_EXISTING_LIST . '" class="hide">' . PHP_EOL;
      $dialog .= '      ' . tep_draw_form( 'list_add_product', tep_href_link( $self_filename, tep_get_all_get_params( array( 'action' ) ) . '&action=list_add_product', 'NONSSL' ), 'post', 'class="shopping_list"' ) . PHP_EOL;
 
Another issue:
 
When you are on the 'shopping_list.php' page, and click the 'try to add/change shopping list', trying to create a new list, nothing happens.
action=list_change_product is called but no change,  should it be action=list_new ?
 
Another issue:
 
shopping_list_id is ambiguous  
 
function id_in_shopping_list( $customers_id, $shopping_list_id, $shopping_list_products_id ) {
      $shopping_list_query_raw = "select sl.shopping_list_id from " . TABLE_SHOPPING_LIST . " sl join " . TABLE_SHOPPING_LIST_PRODUCTS . " slp on (sl.shopping_list_id = slp.shopping_list_id) where sl.customers_id = '" . (int)$customers_id . "' and sl.shopping_list_id = '" . (int)$shopping_list_id . "' and slp.shopping_list_products_id = '" . (int)$shopping_list_products_id . "'";
 
Thank you for your time.

Share this post


Link to post
Share on other sites

1. We don't need SSL for a shopping list, so that should be changed to NONSSL as you said. However, I think your installation has an error, since https should only be used if you have SSL turned on. Check your includes/configure.php.

 

2. That works correctly on my test store. Did you enter a name for your new shopping list?

 

3. My copy shows select *. Are you using the latest version (1.0.1)?

 

Thanks for the bug reports.

 

Regards

Jim

Share this post


Link to post
Share on other sites

The update form seems to have the wrong action attached. I'll fix that. I'll take a look at the products_name field as well.

 

Thanks for the bug reports.

 

Regards

Jim

 

Hi Jim,

 

any luck with the qty not updating?

I have tried fixing it myself but couldnt get it working.

Share this post


Link to post
Share on other sites

@@ShaGGy  I'm testing the fix now. The problem was that the forms on that page were overlapping, which causes one of them to fail. The tricky part is getting the quantity field to work in both forms without overlapping the forms. This requires using Javascript to copy the field value.

 

Regards

Jim

Share this post


Link to post
Share on other sites

@@ShaGGy  I'm testing the fix now. The problem was that the forms on that page were overlapping, which causes one of them to fail. The tricky part is getting the quantity field to work in both forms without overlapping the forms. This requires using Javascript to copy the field value.

 

Regards

Jim

Yes that was what i was confused about there seemed to be two things doing the same :)

Share this post


Link to post
Share on other sites

I've updated the Addon package with fixes for all of the above bugs. Thanks to everyone who provided bug reports.

 

If you're updating from an older version, these files were changed:

/catalog/shopping_list.php

/catalog/includes/shopping_list.php

/catalog/includes/template_top.php
/catalog/includes/template_bottom.php
/catalog/includes/classes/shopping_list.php
 

Regards

Jim

Share this post


Link to post
Share on other sites
I was comparing code from Shopping List 1.0.2,  and may have found an error.  My shopping_list.php is customized, but looking at the new 1.0.2 version.

Located in catalog/shopping_list.php

 

You have moved $products_name below STOCK_CHECK , and attributes. I believe this would prevent them from displaying.

 

 

  if (STOCK_CHECK == 'true') {

            $stock_check = tep_check_stock($product_data['products_id'], $product_data['products_quantity']);

            if (tep_not_null($stock_check)) {

              $products_name .= $stock_check;

            }

          }

 

          // Get options/attributes if any

          if ( isset ($product_data['attributes']) && is_array($product_data['attributes'] ) ) {

            reset( $product_data['attributes'] );

            foreach ( $product_data['attributes'] as $attributes_value ) {

              $products_name .= '              <br /><small><i> - ' . $attributes_value['products_options_name'] . ' ' . $attributes_value['products_options_values_name'] . '</i></small>' . PHP_EOL;

            }

          }

          

          $products_name = '          <span class="td">' . $products_link . '<strong>' . $product_data['products_name'] . '</strong></a>' . PHP_EOL;

 

Thanks

Share this post


Link to post
Share on other sites

You're right, that will fail. I'll fix that and put up a new version.

 

Thanks for the bug report.

 

Regards

Jim

Share this post


Link to post
Share on other sites

I've uploaded a a new version to fix the bug reported by @@daddybird above. If you are updating a previous install, just replace the catalog/shopping_list.php file.

 

Regards

Jim

Share this post


Link to post
Share on other sites

Hi Jim

 a couple of questions if I may before I install this:

 

1) If a customer adds an item to the shopping list and then at some time the store owner deletes that product from the store - or makes it inactive, will it also be removed from shopping lists?

 

2) Could the shopping lists be renamed "wish lists" or something? during install

Share this post


Link to post
Share on other sites

@@Mort-lemur

 

Think I maybe had problems with the option_types and shopping cart list not 100% sure but 99%

 

so do on a test site first if it is one of your option sites

 

Regards

John

Share this post


Link to post
Share on other sites

@@Mort-lemur

  1. No. It should not be removed, but there should be a notice that it is no longer available. I'll add that. Thanks for bringing it to my attention.
  2. Yes, but you should probably be using the Wish List addon. They are designed to do different things.

@@joli1811

Yes, you would need to modify the Shopping List to work with Option Types.

 

Regards

Jim

Share this post


Link to post
Share on other sites

I've never tried, but it should be possible to make it work. Since this addon uses modern code, it's probably going to look a bit odd on your old store.

 

Regards

Jim

Share this post


Link to post
Share on other sites

Love the idea of this addon. But we're experiencing some problems on a (modified) regular 2.3.4. store. 

 

Products with attributes get two entries in the shopping list:

one with a picture, the product name, and everything else

and one with an empty picture, the stock check, all attribute(s) and everything else, as if the attributes are a product by themselves, 

 

If you add another product with another attribute, there is a new entry for the product but the new attribute is combined with the existing attributes in the attribute entry.

 

Very strange indeed!

 

Also, the shopping_list_attributes_id in the shopping_list_products table remains 0, although I'm not sure it is actually being used.

Share this post


Link to post
Share on other sites

I have no idea how you're doing this. The shopping list works in other stores, so there's something wrong in yours, but I don't even know where to tell you to start looking. I can only suggest that you check all of your edits.

 

Regards

Jim

Share this post


Link to post
Share on other sites

The $products_id in the class is killing me (for some reason):

 

$shopping_list_array[$products_id]['attributes'][] = array (
                'products_options_id' => $attributes['products_options_id'],
                'products_options_value_id' => $attributes['products_options_value_id'],
                'products_options_name' => $attributes_values['products_options_name'],
                'products_options_values_name' => $attributes_values['products_options_values_name'],
                'products_options_values_price' => $attributes_values['options_values_price'],
                'products_options_price_prefix' => $attributes_values['price_prefix']
 
When I substitute it for $shopping_list_products_id like in 
 
          $shopping_list_array[$shopping_list_products_id] = array (
            'products_id' => $shopping_list['products_id'],
            'shopping_list_products_id' => $shopping_list_products_id,
            'products_image' => $shopping_list['products_image'],
            'products_name' => $shopping_list['products_name'],
            'products_quantity' => $shopping_list['products_quantity'],
            'products_price' => $shopping_list['products_price'],
            'specials_new_products_price' => $shopping_list['specials_new_products_price'],
            'specials_status' => $shopping_list['specials_status'],
            'products_tax_class_id' => $shopping_list['products_tax_class_id']
          );
 
the problem goes away immediately, resulting in one product in the shopping list attributes included.

Share this post


Link to post
Share on other sites

And another (probably) small thing, products with special characters like ' don't like to be listed (in our test shop):

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Cut', '1' )' at line 11

insert into shopping_list_products ( shopping_list_id, products_id, products_name, products_quantity ) values ( '4', '5', 'Blade Runner - Director's Cut', '1' ) 

Share this post


Link to post
Share on other sites

That second one is definitely a bug. The product name should be scrubbed before it is saved. Apparently I didn't do that. I'll fix that.

 

The first one should not be a problem. $products_id is not a global anywhere in the class; it's just a local value. Do a global searh-and-replace if that fixes it for you. I wonder if PHP has broken something again. What version of PHP are you on?

 

Regards

Jim

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