Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

'your wishlist' menu

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-25-2006, 02:58 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 'your wishlist' menu

A mod to add a 'your wishlist' menu to your site,

wishlist_menu.php - to be put in modules/Wishlist

Code:
<?php if ( $login != "" ) { $wl_raw = func_query("select $sql_tbl[wishlist].*, $sql_tbl[products].forsale from $sql_tbl[wishlist], $sql_tbl[products] where $sql_tbl[wishlist].login='$login' AND $sql_tbl[wishlist].event_id='0' AND $sql_tbl[wishlist].productid = $sql_tbl[products].productid"); $smarty->assign("allow_edit", "Y"); foreach ($wl_raw as $key=>$wl_product) { if($wl_product['forsale'] != 'Y' && $wl_product['forsale'] != 'H') { $ids_redirect[$wl_product['wishlistid']] = $wl_product['productid']; unset($wl_raw[$index]); break; } $wl_raw[$index]["options"] = unserialize($wl_product["options"]); if(!empty($wl_raw[$index]["options"]) && !empty($active_modules['Product_Options'])) { $wl_raw[$index]["variantid"] = func_get_variantid($wl_raw[$index]["options"]); } $wl_product["amount_requested"] = $wl_product["amount"]; if( $wl_product["amount"] > $wl_product["amount_purchased"] && $mode == "friend_wl" ) $wl_raw[$index]["amount"] = $wl_product["amount"] - $wl_product["amount_purchased"]; } $wl_menu = func_products_from_scratch($wl_raw, $user_account["membership"], true ); if($active_modules["Subscriptions"]) { if (!function_exists("SubscriptionProducts")) @include $xcart_dir."/modules/Subscriptions/subscription.php"; $wl_menu = SubscriptionProducts($wl_menu); } if ($active_modules["Product_Configurator"]) { include $xcart_dir."/modules/Product_Configurator/pconf_customer_wishlist.php"; } if (!empty($active_modules["Gift_Certificates"])) { $wl_raw = func_query("select wishlistid, amount, amount_purchased, object from $sql_tbl[wishlist] where login='$login' AND event_id='0' AND productid=0"); if (is_array($wl_raw)) { foreach ($wl_raw as $k=>$v) { $object = unserialize($v["object"]); $wl_giftcerts[] = func_array_merge($v, $object); } if (!empty($wl_giftcerts)) $smarty->assign("wl_giftcerts", $wl_giftcerts); } } $smarty->assign("wl_menu",$wl_menu); } ?>

wishlist_menu.tpl - to be placed in skin1/modules/wishlist
Code:
{capture name=menu} {$lng.lbl_wish_list_edit} {$lng.lbl_friends_wish_list_view} <span class="VertMenuSubTitle">Your Wishlist Contains:</span> <table> {section name=product loop=$wl_menu} <tr><td> {include file="product_thumbnail.tpl" productid=$wl_menu[product].productid image_x=25 product=$wl_menu[product].product tmbn_url=$wl_menu[product].tmbn_url} </td><td> <FONT class="wishlistmenuitems">{$wl_menu[product].product|truncate:20:"..":true}</FONT> </td><td> {include file="modules/Wishlist/wl_menu_buttons.tpl"} </td></tr> {/section} </table> {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_wishlist menu_content=$smarty.capture.menu }

Also add the following to auth.php

Code:
if($active_modules["Wishlist"]) { include $xcart_dir."/modules/Wishlist/wishlist_menu.php"; }

This is for a V4.0.18 site
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #2  
Old 05-03-2006, 05:08 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default

O'm trying to take this site live today so I've had to delete the db, and create a new one form the old one applying all updates etc. It all seems to be working, except for this which has now broke and I'm getting this error:
Code:
Warning: Invalid argument supplied for foreach() in /home/amy2203/public_html/willowtreecrafts/modules/Wishlist/wishlist_menu.php on line 10

can anyone help?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #3  
Old 05-11-2006, 02:38 PM
  girlsbits's Avatar 
girlsbits girlsbits is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 77
 

Default

Quote:
Originally Posted by amy2203
O'm trying to take this site live today so I've had to delete the db, and create a new one form the old one applying all updates etc. It all seems to be working, except for this which has now broke and I'm getting this error:
Code:
Warning: Invalid argument supplied for foreach() in /home/amy2203/public_html/willowtreecrafts/modules/Wishlist/wishlist_menu.php on line 10

can anyone help?

Wishlist is installed by default in v4.0.18, however it's not visible unless a customer is logged in, so uninstall this mod (delete the two newly created files and the extra code you put into "auth.php" , log yourself in as a customer and you will see the "Add To Wishlist" button appear on the product pages.

IMO I think that "Add To Wishlist" should always be visible on the product page, and if an unregistered user tries to add something to their wishlist they should get a "You need to register to use this feature" message.
__________________
X-Cart Gold | v 4.0.18 | Unix | php 4.3 | phpMyAdmin 2.8.0.3 |
Reply With Quote
  #4  
Old 05-12-2006, 02:49 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default

I think we're talking at cross purposes here. I know it's only available when a customer is logged in as you have to be ablke to identify the customer,

This mod added an extra menu to the main structure of the page showing the customer what was in thier wishlist.

As you can see the first part of the php file checks to see if they are logged in so it only runs the code if they are.

This hasn't got anything to do with the add to wishlist buttons,
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:40 PM.

   

 
X-Cart forums © 2001-2020