dblake Posted March 14, 2005 Share Posted March 14, 2005 Yea I have had that problem before when I first installed it. Dunno why it did it, nvr really troubleshooted it, I just fixed it. Open up phpmyadmin (or fav database editor) and edit the wishlist table. You will see the "blank" entry's of the table in there. Just delete them out and you should be fixed. ;) -Dennis Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 14, 2005 Share Posted March 14, 2005 Hi Has anybody setup the wishlist so that the customer can set the sort order i.e 1-10? I need to have it so the customer can put the most wanted item in position 1 and the least wanted in position 10 and also have the ability to change the sort order at any time. (update wishlist) Any ideas on how i could go about implementing this? Thanks Mike Quote Link to comment Share on other sites More sharing options...
dblake Posted March 14, 2005 Share Posted March 14, 2005 Yea add a new field to your table, you can call it sort_order. Then add it into your query and sort by it. Add a text box, for the customer, to allow them to change what product on there wishlist should be 1st. ect... Then the customer can go through, add in there sort order numbers, then when they update it, it addes in the 1-10, and then it sorts by that field. That should get you started ;) -Dennis Quote Link to comment Share on other sites More sharing options...
osCshop Posted March 17, 2005 Share Posted March 17, 2005 Well it has to have something to do with something else you have installed? Install a base oscshop in a different folder, different database. Then install the wishlist and make your box change to only display for logged in users with stuff in it. If it works, then its something else you have tinkered with. Then start backtracking. <{POST_SNAPBACK}> In the stock shop the same error. But on the dutch osC forum someone pointed me to the solution: in includes/classes/split_page_result search for $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1)); $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; and replace for $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1)); if ($offset < 0) $offset = 0; $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; My servers use PHP 4.3.10 (Zend: 1.3.0) and MySQL 4.1.8 & 4.1.9 Hope this info is usefull for more people Quote Link to comment Share on other sites More sharing options...
dblake Posted March 17, 2005 Share Posted March 17, 2005 (edited) Thats because the install directions weren't updated when homewetbar uploaded his new version, or w/e... Change this: <!-- Wish List 2.3 Start --> <td align="center" class="main"><?php echo tep_draw_hidden_field('wishlist_action', 'add_wishlist') . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST, 'onClick="document.cart_quantity.action=\''. FILENAME_WISHLIST . '\';document.cart_quantity.submit();"'. ' action=add_wishlist'); ?></td> <!-- Wish List 2.3 End --> to this: <!-- Wish List 2.3 Start --> <td align="center" class="main"><?php echo tep_draw_hidden_field('wishlist_action', 'add_wishlist') . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST, 'onClick="document.cart_quantity.action=\''. tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '\';document.cart_quantity.submit();"'); ?></td> <!-- Wish List 2.3 End --> on product_info.php ;) <{POST_SNAPBACK}> To Further comment on this as it didnt dawn on me at the time, but if a user browsers your site with cookies disabled, then they will lose there session and get logged out if you dont have this link this way. Or any other link for that matter in your site. osCshop: Im glad you finally got that working, it didn't even dawn on me about that offset bug. I know the error you were getting was pointing to your split page results query, its just didnt hit me. Nice job. Edited March 17, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 Yea add a new field to your table, you can call it sort_order. Then add it into your query and sort by it. Add a text box, for the customer, to allow them to change what product on there wishlist should be 1st. ect... Then the customer can go through, add in there sort order numbers, then when they update it, it addes in the 1-10, and then it sorts by that field. That should get you started ;) -Dennis <{POST_SNAPBACK}> Hi Dennis Thanks for the above :thumbsup: I have added a new field called sort_order in the wishlist table and put some values in 1,2,3... added it to the query, but the wishlist will now display the same product 3 times :blink: Have i done the query correct? $products_query = tep_db_query("select pd.products_id, pd.products_name, p.products_image, w.sort_order from " . TABLE_WISHLIST. " w, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id in (" . $product_ids . ") and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by sort_order"); Thanks Mike Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 Wrong query, put your sort order in this one $wishlist_query_raw = "select * from " . TABLE_WISHLIST . " where customers_id = '" . $customer_id . "' order by products_name"; Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 Right now it has order by products_name, change it to sort_order ;) Have fun! Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 Actually Im wrong, give me a sec Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 Change your query to this and let me know if it works. $products_query = tep_db_query("select pd.products_id, pd.products_name, p.products_image, w.sort_order from " . TABLE_WISHLIST. " w, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id in (" . $product_ids . ") and p.products_id = pd.products_id and w.productw_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by w.sort_order"); Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 Change your query to this and let me know if it works. $products_query = tep_db_query("select pd.products_id, pd.products_name, p.products_image, w.sort_order from " . TABLE_WISHLIST. " w, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id in (" . $product_ids . ") and p.products_id = pd.products_id and w.productw_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by w.sort_order"); <{POST_SNAPBACK}> nope, that gives me an error "1054 - Unknown column 'w.productw_id' in 'where clause'" :-" Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 change productw to pruducts it was a typo Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 omg.... w.products_id i really cant type today Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 change productw to pruducts it was a typo <{POST_SNAPBACK}> :thumbsup: sweet, i did think at the time that it looked a bit odd :-" next up is to display the field and make it so the user can amend it :huh: Cheers Mike Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 Dennis Am i going in the right direction with this? <?php echo tep_draw_input_field('sort_order[]', $products[$i]['sort_order'], 'size="1"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']); ?><br> Is this any good? The field displays fine, but, i am not sure how to display the current sort order. Any ideas? Thanks Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 add a value="addin query for sortorder" Quote Link to comment Share on other sites More sharing options...
osCshop Posted March 19, 2005 Share Posted March 19, 2005 I would like to change just 1 more thing; Now if the wishlist is empty there's no box (Thanks Dennis). In the box I've removed the link to the wishlist . I've replaced the textlink to wishlist faq for a 20x14 info image that links to the faq. In my menu I have a link "Wishlist". It would be nice if the user is not registered/logged in the link points to wishlist faq. In wishlist faq there should be a line like "If you have a account, please login(link) to show your wishlist. Else register(link) to use the wishlist function." If a registered user uses the link in the menu he should go to the wishlist page. If the wishlist is empty I want after "No products are in your Wishlist" the same Info image that I use in the box (wich links to the faq). This way I think it looks much cleaner. Not the skills to get this job done. Maybe more people like the idea(?), help is welcome.. TIA Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 osCshop For the link to change you would need something like this <?php if (tep_session_is_registered('customer_id')) { echo '<a href="' . tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '">' . tep_image_button('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST) . '</a>'; } else { echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_create_account.gif', IMAGE_BUTTON_CREATE_ACCOUNT) . '</a></td>'; } All i have done here is either display a "add to wishlist button" if logged in or "create account button" if not. You could modify the above to display either a "wishlist" or "FAQ" link Hope that helps Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 In my menu I have a link "Wishlist". It would be nice if the user is not registered/logged in the link points to wishlist faq. In wishlist faq there should be a line like "If you have a account, please login(link) to show your wishlist. Else register(link) to use the wishlist function." If a registered user uses the link in the menu he should go to the wishlist page. If the wishlist is empty I want after "No products are in your Wishlist" the same Info image that I use in the box (wich links to the faq). This way I think it looks much cleaner. Not the skills to get this job done. Maybe more people like the idea(?), help is welcome.. TIA <{POST_SNAPBACK}> Use the same code that is used for the wishlist box. If(tep_session_is_registered.... that code is in the column right box, I think? Just follow suit. The code is universal and can be used everywhere. Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 yea what mighty mike said ;) Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 add a value="addin query for sortorder" <{POST_SNAPBACK}> Dennis sorry to sound so dumb :huh: But i have no idea what you mean I created a new query $sort_order = tep_db_query ("select products_id, sort_order from " . TABLE_WISHLIST . " where customers_id = '" . $customer_id . "'"); then i did a php echo to see what i was getting and it gave me this "Resource id #189" :blink: what the hell is that? So i think i am getting well in the deepend now have you got msn? Thanks Mike Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 you didnt need to create a new query. With you input field, you know they have values. For example, <input type="text" size="5" name="sort_order[]" value="<?php echo $products[sort_order]; ?>" /> Thats what I meant. That way when the page is loaded, it will load the stored value into the input box right away. You will have to add another submit button as an update then add another borror switch in so you can update your sort order ;) Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 so i dont need to have this <?php echo tep_draw_input_field('sort_order[$sort_order]', $products[$i]['sort_order'], 'size="1"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']); ?><br> just use your code? Quote Link to comment Share on other sites More sharing options...
dblake Posted March 19, 2005 Share Posted March 19, 2005 look on the shopping cart and see how they did the quanitity box, follow suit with that and you should be fine :) Quote Link to comment Share on other sites More sharing options...
Mighty Mike Posted March 19, 2005 Share Posted March 19, 2005 yeah, thats what i was looking at, but got a bit lost :o Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.