♥stubbsy Posted September 8, 2010 Share Posted September 8, 2010 Hi :) I would like split the page with ALL my PRODUCT (Default view ) I've over 5000 PRODUCT and when i use your plugin... my poor Sql Server will overload! How i can split , for example , 100 product per page ? Hi has anyone managed to put a split page on the results so that the whole catalogue is not displayed? Dave Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted September 8, 2010 Author Share Posted September 8, 2010 Hi :) I would like split the page with ALL my PRODUCT (Default view ) I've over 5000 PRODUCT and when i use your plugin... my poor Sql Server will overload! How i can split , for example , 100 product per page ? this would be a rather big/serious extension to this otherwise simple contribution. my immediate questions would be, - a % discount should it be on the whole selection or just the items displayed on the page (how would the system know which ones are shown) - if you make changes, and you page to the next page, should it detect these intelligently ? Now as for the 5000 products, sure they are not all in the same category, are they ? I have 10000 products about 6000 active, and nicely categorized, some pages are rather long, but when I combine category with manufacturer it is fairly manageable. Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted September 8, 2010 Author Share Posted September 8, 2010 Hi Carine Great contrib, works like a charm ! The easiest addon i ever install Thank you for sharing your work. Can i suggest one more thing in the ToDo list ? It will be great to have a way to set a beguinning date and expires date. What do you think about ? looking forward to reading you Best regards and happy new year David As you said, would be nice, but I have no use for it, so I won't be developing this. When my promo prices change, I need to reprint pricelabels for the physical store, so unfortunately for you, unless the webserver can tell the barcode printer to printout these changed items automatically, I'm not going to use these dates. Now, you did make me think, maybe sometime, someday, I'm crazy enough to find a solution to this. Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
skylinemarket Posted September 16, 2011 Share Posted September 16, 2011 Hi, I seem to be getting an error with this part of the instructions: 2. In admin/includes/boxes/catalog.php add: with the last declared array( 'code' => FILENAME_SPECIALSBYCAT, 'title' => BOX_CATALOG_SPECIALSBYCAT, 'link' => tep_href_link(FILENAME_SPECIALSBYCAT, '', 'NONSSL') ) Here is my catalog.php but I don't know where to put it: ------------- <?php $heading = array(); $contents = array(); $heading[] = array('text' => BOX_HEADING_CATALOG, 'link' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog')); if ($selected_box == 'catalog') { $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' . '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); } $box = new box; echo $box->menuBox($heading, $contents); ?> ------------- Many thanks. Quote Link to comment Share on other sites More sharing options...
skylinemarket Posted September 25, 2011 Share Posted September 25, 2011 (edited) Can anyone please help!! My admin/includes/boxes/catalog.php file looks like this: <?php /* $Id: catalog.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ ?> <!-- catalog //--> <tr> <td> <?php $heading = array(); $contents = array(); $heading[] = array('text' => BOX_HEADING_CATALOG, 'link' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog')); if ($selected_box == 'catalog') { $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' . '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' . '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); } $box = new box; echo $box->menuBox($heading, $contents); ?> </td> </tr> <!-- catalog_eof //--> whereas the file included implies it should look like this! <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ $cl_box_groups[] = array( 'heading' => BOX_HEADING_CATALOG, 'apps' => array( array( 'code' => FILENAME_CATEGORIES, 'title' => BOX_CATALOG_CATEGORIES_PRODUCTS, 'link' => tep_href_link(FILENAME_CATEGORIES) ), array( 'code' => FILENAME_PRODUCTS_ATTRIBUTES, 'title' => BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES, 'link' => tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES) ), array( 'code' => FILENAME_MANUFACTURERS, 'title' => BOX_CATALOG_MANUFACTURERS, 'link' => tep_href_link(FILENAME_MANUFACTURERS) ), array( 'code' => FILENAME_REVIEWS, 'title' => BOX_CATALOG_REVIEWS, 'link' => tep_href_link(FILENAME_REVIEWS) ), array( 'code' => FILENAME_SPECIALS, 'title' => BOX_CATALOG_SPECIALS, 'link' => tep_href_link(FILENAME_SPECIALS) ), array( 'code' => FILENAME_PRODUCTS_EXPECTED, 'title' => BOX_CATALOG_PRODUCTS_EXPECTED, 'link' => tep_href_link(FILENAME_PRODUCTS_EXPECTED) ), array( 'code' => FILENAME_SPECIALSBYCAT, 'title' => BOX_CATALOG_SPECIALSBYCAT, 'link' => tep_href_link(FILENAME_SPECIALSBYCAT, '', 'NONSSL') ) ) ); ?> I get a 500 server error if I try and edit the top section of code to include the missing array, and if I upload the bottom bit of code instead the catalog part of the admin box just doesn't appear ! Somebody please help! I am running v2.2 RC2 if that is the issue?? Edited September 25, 2011 by skylinemarket Quote Link to comment Share on other sites More sharing options...
LencTPH Posted November 2, 2011 Share Posted November 2, 2011 When i start contrib. I get this HTTP 500 (Internal Server Error): any help?? Quote Link to comment Share on other sites More sharing options...
Juto Posted January 26, 2012 Share Posted January 26, 2012 Hi, and thanks for a nice contribution. I would like to have the possibility to set the status for all displayed products, like you set the discount. And to be able to set that status for each individual product, just like you can do with the discount. Any suggestions/help is much appreciated. Sara Quote Contributions: http://addons.oscommerce.com/info/8010 http://addons.oscommerce.com/info/8204 http://addons.oscommerce.com/info/8681 Link to comment Share on other sites More sharing options...
Patty Posted December 8, 2017 Share Posted December 8, 2017 Hi there. I know it's been a long time, but I just installed this contribution and it works great, except for one little thing: it does not insert in the database the date the special price was added, so products won't show as newest on the Specials page in the store. I'm not a coder so I can't fix this by myself. Can someone help me with that? I hate to do this but here's the code to expedite things: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'setflag': tep_set_specials_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag']); tep_redirect(tep_href_link(FILENAME_SPECIALS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'sID=' . $HTTP_GET_VARS['id'], 'NONSSL')); break; case 'insert': $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']); $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']); $expdate = tep_db_prepare_input($HTTP_POST_VARS['expdate']); if (substr($specials_price, -1) == '%') { $new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $new_special_insert = tep_db_fetch_array($new_special_insert_query); $products_price = $new_special_insert['products_price']; $specials_price = ($products_price - (($specials_price / 100) * $products_price)); } $expires_date = ''; if (tep_not_null($expdate)) { $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2); } tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')"); tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'])); break; case 'update': $specials_id = tep_db_prepare_input($HTTP_POST_VARS['specials_id']); $products_price = tep_db_prepare_input($HTTP_POST_VARS['products_price']); $specials_price = tep_db_prepare_input($HTTP_POST_VARS['specials_price']); $expdate = tep_db_prepare_input($HTTP_POST_VARS['expdate']); if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price)); $expires_date = ''; if (tep_not_null($expdate)) { $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2); } tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . " where specials_id = '" . (int)$specials_id . "'"); tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $specials_id)); break; case 'deleteconfirm': $specials_id = tep_db_prepare_input($HTTP_GET_VARS['sID']); tep_db_query("delete from " . TABLE_SPECIALS . " where specials_id = '" . (int)$specials_id . "'"); tep_redirect(tep_href_link(FILENAME_SPECIALS, 'page=' . $HTTP_GET_VARS['page'])); break; } } require(DIR_WS_INCLUDES . 'template_top.php'); ?> <?php //Fetch all variables $fullprice = (isset($_GET['fullprice']) ? $_GET['fullprice'] : ''); $productid = (isset($_GET['productid']) ? (int)$_GET['productid'] : '0'); $inputupdate = (isset($_GET['inputupdate']) ? $_GET['inputupdate'] : ''); $categories = (isset($_GET['categories']) ? (int)$_GET['categories'] : '0'); if (array_key_exists('discount',$_GET)) { if (is_numeric($_GET['discount'])) { $discount = (float)$_GET['discount']; } else { $discount = -1; } } else { $discount = -1; } if ($fullprice == 'yes') tep_db_query("DELETE FROM " . TABLE_SPECIALS . " WHERE products_id=$productid;"); else if($inputupdate == "yes"){ $inputspecialprice = (isset($_GET['inputspecialprice']) ? $_GET['inputspecialprice'] : ''); if (substr($inputspecialprice, -1) == '%') { $productprice = (isset($_GET['productprice']) ? (float)$_GET['productprice'] : ''); $specialprice = ($productprice - (($inputspecialprice / 100) * $productprice)); } else { $specialprice = $inputspecialprice; } $alreadyspecial = tep_db_query ("SELECT * FROM " . TABLE_SPECIALS . " WHERE products_id=$productid;"); $specialproduct= tep_db_fetch_array($alreadyspecial); if ($specialproduct["specials_id"]){ //print ("Database updated. Status:".$specialproduct["status"]); tep_db_query ("UPDATE " . TABLE_SPECIALS . " SET specials_new_products_price='$specialprice' where products_id=$productid ; "); } else{ //print("New product added to specials table"); $today = date("Y-m-d H:i:s"); tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " VALUES ('','$productid','$specialprice','$today','','','','1');"); } } ?> <form action="<?php echo $current_page; ?>" method="get"> <table><tr class="dataTableHeadingRow"><td class="dataTableHeadingContent" colspan="6"> <?php echo TEXT_SELECT_CAT .' ' . tep_draw_pull_down_menu('categories', tep_get_category_tree(), $categories); echo TEXT_ENTER_DISCOUNT . ': '; ?> <input type="text" size="4" name="discount" value="<?php if ($discount > 0) { echo $discount; } ?>"><?php echo TEXT_PCT_AND; ?> <input type="submit" value="<?php echo TEXT_BUTTON_SUBMIT; ?>"> </form></td></tr> <tr class="dataTableContent"><td class="dataTableContent" colspan="6"> <?php echo TEXT_INSTRUCT_TITLE; ?><br /> <ul><li><?php echo TEXT_INSTRUCT_1; ?></li> <li><?php echo TEXT_INSTRUCT_2; ?></li> <li><?php echo TEXT_INSTRUCT_3; ?></li> </ul> </td></tr> <?php if ($discount == -1) { //echo 'do nothing'; } else if ($discount == 0) { $result2 = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_id=ptc.products_id and ptc.categories_id=$categories"); while ( $row = tep_db_fetch_array($result2) ){ $allrows[] = $row["products_id"]; } tep_db_query("DELETE FROM " . TABLE_SPECIALS . " WHERE products_id in ('".implode("','",$allrows)."');"); } else if ($discount > 0) { $specialprice = $discount / 100; $result2 = tep_db_query("select p.products_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_id=ptc.products_id and ptc.categories_id=$categories"); while ( $row = tep_db_fetch_array($result2) ){ $hello2 = $row["products_price"]; $hello3 = $hello2 * $specialprice; $hello4 = $hello2 - $hello3; $number = $row["products_id"]; $result3 = tep_db_query("select * from " . TABLE_SPECIALS . " where products_id = $number"); $num_rows = tep_db_num_rows($result3); if ($num_rows == 0){ //echo "Insert into specials (products_id, specials_new_products_price) values ($number, '$hello4')"; tep_db_query("Insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price) values ($number, '$hello4'); "); } else { //echo "Update specials set specials_new_products_price='$hello4' where products_id=$number"; tep_db_query ("Update " . TABLE_SPECIALS . " set specials_new_products_price='$hello4' where products_id=$number;"); } } } print (" <tr class=\"dataTableHeadingRow\"> <td class=\"dataTableHeadingContent\">". TABLE_HEADING_PRODUCTS ."</td> <td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PRODUCTS_PRICE ."</td> <td class=\"dataTableHeadingContent\">" . TABLE_HEADING_SPECIAL_PRICE ."</td> <td class=\"dataTableHeadingContent\">" . TABLE_HEADING_PCT_OFF ."</td> <td class=\"dataTableHeadingContent\">" . TABLE_HEADING_FULL_PRICE . "</td> </tr>"); $result2 = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc, " . TABLE_PRODUCTS . " p where pd.products_id=ptc.products_id and p.products_id=ptc.products_id and ptc.categories_id = $categories and pd.language_id = " .(int)$languages_id . " order by pd.products_name asc "); while ( $row = tep_db_fetch_array($result2) ) { $number = $row["products_id"]; $result3 = tep_db_query("SELECT * FROM " . TABLE_SPECIALS . " where products_id=$number"); $num_rows = tep_db_num_rows($result3); if ($num_rows == 0) { $specialprice = "none"; $implieddiscount = ''; } else { while ( $row2 = tep_db_fetch_array($result3) ) { $specialprice = $row2["specials_new_products_price"]; if ($row["products_price"] > 0) { $implieddiscount = '-'.(100-(($specialprice / $row["products_price"])*100)).'%'; } else { $implieddiscount = ''; } } } print("<form action=\"$current_page\" method=\"get\">"); print(" <tr class=\"dataTableRow\" onmouseover=\"rowOverEffect(this)\" onmouseout=\"rowOutEffect(this)\" > <td class=\"dataTableContent\">" . $row["products_name"] . "</td> <td class=\"dataTableContent\">" . $row["products_price"] . "</td> <td class=\"dataTableContent\"><input name=\"inputspecialprice\" type=\"text\" value=\"$specialprice\"></td> <td class=\"dataTableContent\">$implieddiscount </td> <td class=\"dataTableContent\"><input type=\"checkbox\" name=\"fullprice\" value=\"yes\"></td> <td class=\"dataTableContent\"><input type=\"hidden\" name=\"categories\" value=\"" . $categories ."\"> <input type=\"hidden\" name=\"productprice\" value=\"" . $row["products_price"] . "\"> <input type=\"hidden\" name=\"productid\" value=\"" . $row["products_id"] . "\"> <input type=\"hidden\" name=\"inputupdate\" value=\"yes\"> <input type=\"submit\" value=\"" . TEXT_BUTTON_UPDATE . "\"></td></tr></form>"); } print ("</table>"); ?> <!------------------------ Code for Specials Admin ends here ---------------------------> </td> </tr> </table> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Tks in advance for any help! Quote Patty Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted December 8, 2017 Author Share Posted December 8, 2017 I just have the specials page sorted by specials_id desc, so newly added show first ... would that work for you ? Quote KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Patty Posted December 11, 2017 Share Posted December 11, 2017 Thank you, but the issue is that the date the special was added was not inserted on the database, so sorting won't work. I found a way around it that seems to be working fine. I replaced this line $today = date("Y-m-d H:i:s"); tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " VALUES ('','$productid','$specialprice','$today','','','','1');"); with // $today = now(); tep_db_query ("INSERT INTO " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) VALUES ('$productid','$specialprice',now(),'','1');"); Quote Patty 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.