Here's my patch for the wishlist screen



#1 :  Add call to item functions at top of file after attribute
function include

 // get attribute functions
 include(APPLICATION_ROOT .
"/modules/include/attribute_functions");

 // get item functions
 include(APPLICATION_ROOT . "/modules/include/item_functions");

_____________________________________________

#2 : Add i.ID to the $Query string after i.Name

 /*
 ** Get the list of stuff in the wish list.
 */
 if ($continueScript)
 {
  $Query = "SELECT s.ID, s.ExternalSKU, s.Name, s.ListPrice, ";
  $Query .= "s.SalePrice, i.Name, i.ID, us.Notes, us.ID "; //
<=== i.ID, added
  $Query .= "FROM session, user_sku us, sku s, item i ";
  $Query .= "WHERE us.SKU = s.ID ";
  $Query .= "AND s.Item = i.ID ";
  $Query .= "AND session.ID = '$sid' ";
  $Query .= "AND session.User = us.User ";
  $DatabaseResult = mysql_query($Query, $DatabaseLink);
____________________________________________

#3: add $item_sku to the list command to hold the i.ID value
added above



  /* Output a row for each item in the wishlist. */

   $index = 0;   // =============== NEW (initialize variable for
later)

   while($DatabaseRow = mysql_fetch_row($DatabaseResult))
   {
     // =========================== NEW
     // add $item_sku to list in the same place
     // you put the i.ID in the $Query string

     list($sku_ID, $sku_ExternalSKU, $sku_Name, $sku_Price,
$sku_SalePrice,
     $item_Name, $item_sku, $sku_Variation, $user_sku_ID) =
$DatabaseRow;

_____________________________________________

#4 :  Modify the section for adding the add button with the
following changes



    // button for adding item to basket

    // ===================================== NEW SECTION
    // March 27, 2000
    // get item info for the SKU
    // we need to get the correct info based on what's in the
wishlist

       $Item = GetItemInfo($item_sku);
       $count = 0; // used to get array position

       // matches the right sku with the right item details
       while ( list($key,$value) =
each($Item["SKU"]["ExternalSKU"]) )


           if ($value == $sku_ExternalSKU) $index = $count;
           $count++;
       }

       // the regular display routine is replaced by this one
       // check inventory levels
       // total items in warehouse = Available + Reserve

       if($Item["SKU"]["Available"][$index] +
$Item["SKU"]["Reserve"][$index]  > 0)
       {
           print("<TD VALIGN=\"top\">");
           print(StartForm("wishlist", 'post',
'ADD_FROM_WISHLIST', FALSE,
               array("input_ID"=>"$user_sku_ID")));
           print("<INPUT TYPE=\"submit\"
value=\"".L_WISHLIST_ADD_BASKET."\">");
           print("</FORM>\n");
           print("</TD>\n");
       }
       elseif($Item["SKU"]["Backorder"][$index] == 'Y')
       {
           print("<TD VALIGN=\"top\">");
           print(StartForm("wishlist", 'post',
'ADD_FROM_WISHLIST', FALSE,
               array("input_ID"=>"$user_sku_ID")));
           print("<INPUT TYPE=\"submit\" value=\"Backorder
*\">");
           print("</FORM>\n");
           print("</TD>\n");
           $BackorderedItems = true;
       }

____________________________________________

#5 : And finally, just add these last changes to the end of the
file

    // delete button (unchanged)
    print("<TD VALIGN=\"top\">");
    print(StartForm("wishlist", 'post', 'REMOVE_FROM_WISHLIST',
FALSE,
        array("input_ID"=>"$user_sku_ID")));
    print("<INPUT TYPE=\"submit\"
value=\"".L_WISHLIST_REMOVE."\">");
    print("</FORM>\n");

    print("</TD>\n");
    print("</TR>\n");

    $index = 0; // =============== NEW (reset $index to zero)
   }
   print("<TR><TD COLSPAN=\"5\"><HR
WIDTH=\"100%\"></TD></TR>\n");

   // ============================ NEW
   // add backorder item text
   if($BackorderedItems)
   {
   print("<tr><td colspan=\"5\">" . L_ITEM_BACKORDERED .
"</td></tr>");
   }

   print("</TABLE>\n");

  }
 }

________________________________________________


That should do it... not much to it :)  I'm not familiar with the
whole FreeTrade package yet... as i've only had it a few days...
But that's what I hacked out and would love to know if there's a
better or faster way (as i would imagine most of us would)

Good luck :)

Roger




------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to