tigergirl Posted September 13, 2010 Posted September 13, 2010 Hi, I have free samples available and I don't want them showing in the also_purchased_products module as I'd like this to advertise money making stock not freebies - how can I hide certain products from showing? Also, people are taking advantage of the freebies and I only want them to be able to add 1 of each sample to their cart with a maximum of 5 samples per order- what snippet could I use to fix that? Is there something available for this I have missed? Hopefully someonce can help my small problemo. Thanks so much Tigergirl I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire
♥Monika in Germany Posted September 13, 2010 Posted September 13, 2010 as for the exclusion of certain products in the also purchased file, you could do it this way: if (isset($HTTP_GET_VARS['products_id'])) { //comma separated list of products_ids $exclude_products = '11, 144, 166'; $orders_query = tep_db_query("select p.products_id, p.products_image from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p where opa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' and p.products_id not in (" . $exclude_products . ") group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED); $num_products_ordered = tep_db_num_rows($orders_query); if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) { :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
♥Monika in Germany Posted September 13, 2010 Posted September 13, 2010 your sample products issue could be fixed in the shopping_cart class, again by defining an array and then setting limits ... but this part is more complicated and cannot be sketched down in a few lines... :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
tigergirl Posted September 14, 2010 Author Posted September 14, 2010 as for the exclusion of certain products in the also purchased file, you could do it this way: if (isset($HTTP_GET_VARS['products_id'])) { //comma separated list of products_ids $exclude_products = '11, 144, 166'; $orders_query = tep_db_query("select p.products_id, p.products_image from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p where opa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' and p.products_id not in (" . $exclude_products . ") group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED); $num_products_ordered = tep_db_num_rows($orders_query); if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) { Hi, thanks for the snippet - that's exactly what I wanted. The other issue isn't so urgent as I just send them one sample anyway but I would prefer there to be a restriction on the number they can add to the cart. Cheers Tigergirl I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire
Recommended Posts
Archived
This topic is now archived and is closed to further replies.