Web-Source 5 Posted January 6, 2013 Share Posted January 6, 2013 More PCI compliance for .htaccess: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^account.php https://example-domain-please-change-me.com/account.php [R=301,L] # #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^affiliate_affiliate.php https://example-domain-please-change-me.com/affiliate_affiliate.php [R=301,L] # #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^affiliate_summary.php https://example-domain-please-change-me.com/affiliate_summary.php [R=301,L] # #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^login.php https://example-domain-please-change-me.com/login.php [R=301,L] # #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^create_account.php https://example-domain-please-change-me.com/create_account.php [R=301,L] # #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^checkout_confirmation.php https://example-domain-please-change-me.com/checkout_confirmation.php [R=301,L] </IfModule> Link to comment Share on other sites More sharing options...
Web-Source 5 Posted January 7, 2013 Share Posted January 7, 2013 Heres a handy snippet for adding product to cart from an external URL, or just in plain HTML format: <a href="http:/your-site.com/index.php/cPath/#/action/buy_now/products_id/#">Add To Cart</a> Replace "#" with the category id and product id. Link to comment Share on other sites More sharing options...
burt Posted January 30, 2013 Author Share Posted January 30, 2013 PHPMYADMIN Update weight of all products in a known category; update products set products_weight = 'Y' where products_id in (select products_id from products_to_categories where categories_id = X) Change Y to the desired weight and X to the ID of the category. Link to comment Share on other sites More sharing options...
burt Posted February 13, 2013 Author Share Posted February 13, 2013 I needed to ensure that stock does not reduce below zero, as part of my barcode system for shops that are both online and high street. This takes care of it; tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = GREATEST(products_quantity-1, 0) where products_upc = '" . $scanned_upc . "'"); Now if the stock in the high street shop is sitting at 1 piece and it is scanned (making the stock go to zero), any mistaken scan would mean the stock stays at zero. Eg, if the assistant makes a mistake and scans the barcode twice. We need to ensure that stock does not go into negative numbers so that when stock is replenished (via barcode), the stock level is correct. Example: stock sits at 1. Accidentally scanned twice. Stock now sits at -1 (assume there is no failsafe to keep stock at zero). High Street gets new stock comprising 3 items. These are scanned in to update stock. Stock now sits at 2. But there are actually 3 for sale; -1 + 3 = 2 whereas, with the failsafe; 0 + 3 = 3 Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted February 13, 2013 Share Posted February 13, 2013 PHPMYADMIN Update weight of all products in a known category; update products set products_weight = 'Y' where products_id in (select products_id from products_to_categories where categories_id = X) Change Y to the desired weight and X to the ID of the category. Not exactly a tip, but one of my customizations is the addition of a categories_weight field ( a field cloned from sort_order) and when a products_weight is missing, it defaults to the categories weight, if that is missing, it tels the customer to contact us as the item is missing data to provide an accurate shipping 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...
Juto Posted February 13, 2013 Share Posted February 13, 2013 Replace target="_blank" with the correct javascript syntax (example): <a href="http://www.yourdomain.com/yourfile.php" onclick="window.open(this.href); return false;">your link text</a> Sara 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...
Juto Posted February 13, 2013 Share Posted February 13, 2013 w3c compliance Replace all instances of 'hspace="5" vspace="5"' with ' class="image-margins"' and add the class to your stylesheet. Sara 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...
burt Posted February 19, 2013 Author Share Posted February 19, 2013 All of the 2 country ISO codes, which I needed to find but could not find (admittedly did not try very hard):ALL ISO's AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,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, GF,PF,TF,GA,GM,GE,GH,GI,GL,GD,GP,GU,GT,GG,GN,GW,GY, HT,HM,VA,HN,HK, IS,IN,ID,IR,IQ,IM,IL, JM,JP,JE,JO, KZ,KE,KI,KP,KR,KW,KG, LA,LB,LS,LR,LY,LI, MO,MK,MG,MW,MY,MV,ML,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM, NA,NR,NP,NC,NZ,NI,NE,NG,NU,NF,MP,NO, OM, PK,PW,PS,PA,PG,PY,PE,PH,PN,PR, QA, RE,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS, SM,ST,SA,SN,RS,SC,SL,SG,SX,SB,SO,ZA,GS,SS,LK,SD,SR,SJ,SZ,CH,SY, TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV, UG,UA,AE,UM,US,UY,UZ, VU,VE,VN,VG,VI, WF,EH, YE, ZM,ZW Link to comment Share on other sites More sharing options...
cannuck1964 Posted February 19, 2013 Share Posted February 19, 2013 @@burt Not quite sure how that is a useful code snippet... But on another note, you can use GEOIP to ban countries countries IPs from going to your site. Just add this to your htaccess file: <IfModule mod_geoip.c> GeoIPEnable ON # add one line for each country you wish to block #Vietanm SetEnvIF GEOIP_COUNTRY_CODE VN BlockThese #russia SetEnvIF GEOIP_COUNTRY_CODE RU BlockThese #romania SetEnvIF GEOIP_COUNTRY_CODE RO BlockThese #turkey SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese #China SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese #Nigeria SetEnvIF GEOIP_COUNTRY_CODE NG BlockThese #Iran SetEnvIF GEOIP_COUNTRY_CODE IR BlockThese Deny from env=BlockThese </IfModule> Peter McGrath ----------------------------- See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation Link to comment Share on other sites More sharing options...
burt Posted February 19, 2013 Author Share Posted February 19, 2013 @@cannuck1964 - will be very useful for me if for no-one else ;) Link to comment Share on other sites More sharing options...
burt Posted February 21, 2013 Author Share Posted February 21, 2013 update products set products_price = (products_price*Y) where products_id in (select products_id from products_to_categories where categories_id = X) increase or decrease prices by a percentage, of all products in a given category. Change y to the increase/decrease (eg: make prices 20% more = 1.2), change x to the id of the category to change. Link to comment Share on other sites More sharing options...
burt Posted March 11, 2013 Author Share Posted March 11, 2013 Update price of products by a given manufacturer. update `products` set `products_price` = (`products_price` * 'x.yz') WHERE `manufacturers_id` = 'w'; Change x.yz to the increase amount, eg increase prices by 15% would be 1.15. Change w to the ID of the manufacturer. Link to comment Share on other sites More sharing options...
tgely Posted March 11, 2013 Share Posted March 11, 2013 Before MySql update training in Workbrench SET SQL_SAFE_UPDATES=0; osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
motorcity Posted March 22, 2013 Share Posted March 22, 2013 Somewhere I heard it might hurt you to ignore ip canonicalization, This addon to .htaccess is supposed to fix that. Any comments from you SEO folks? # Eliminates www vs. non-www RewriteCond %{HTTP_HOST} ^domain\.com [OR] RewriteCond %{HTTP_HOST} ^123\.45\.67\.89 RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] edit; I guess you really need the [OR] to get this working! Link to comment Share on other sites More sharing options...
motorcity Posted March 23, 2013 Share Posted March 23, 2013 Here's a different one. Directly backing up a table from a table in phpmyadmin / sql UPDATE products p, 0214products p2 SET p.products_price = p2.products_price, p.products_weight = p2.products_weight, p.products_length = p2.products_length, p.products_width = p2.products_width, p.products_height = p2.products_height, p.suggested_retail = p.suggested_retail WHERE p.products_id = p2.products_id AND p.products_ready_to_ship = 1 AND p.products_id = 1 The key here is understanding I'm using "p.products_ready_to_ship = 1" as a switch. I sorted the database and those products with corrupted data became "p.products_ready_to_ship = 1" first. The second thing is the last part of the where; "AND p.products_id = 1" this is just a test row I'm watching as I run the query. If it doesn't work right I only have one row (I hopefully jotted down the undisturbed details prior to running the query - should go without saying right?). No doubt this is dangerous. Create test tables by copying real ones. Test those first. Link to comment Share on other sites More sharing options...
burt Posted April 15, 2013 Author Share Posted April 15, 2013 UPDATE `orders` SET `customers_postcode` = UPPER(`customers_postcode`); This will update all your postcodes to upper case. There are a few other places where postcodes are stored. You might also want to enforce a strtoupper($postcode) on the DB inserts in create_account and address_book_process Link to comment Share on other sites More sharing options...
Harald Ponce de Leon Posted May 2, 2013 Share Posted May 2, 2013 Pages loading slow under your Windows development environment? I just experienced load times of around 2-3 seconds and discovered changing the database server address from: localhost to: 127.0.0.1 fixes the problem. Pages now load lightning fast! This can be done in includes/configure.php and admin/includes/configure.php, for the DB_SERVER value. , osCommerce Link to comment Share on other sites More sharing options...
foxp2 Posted May 2, 2013 Share Posted May 2, 2013 for System & Network which support IPV6 protocol, add in your [Drive Letter]:\Windows\System32\Drivers\etc\hosts* : ::1 localhost * administrator rights required. Link to comment Share on other sites More sharing options...
♥GLWalker Posted May 28, 2014 Share Posted May 28, 2014 Ive found some older databases may have orphaned address_book entries due to not properly removing customers or whatever reasons - here are some snippets to clean up the address_book table. First, run this query and if you have any records returned, create a view SELECT * FROM address_book a WHERE NOT EXISTS (SELECT 1 FROM customers c WHERE c.customers_id = a.customers_id) ORDER BY a.customers_id; ~Do a google for creating a view in phpMyAdmin ~ lots of info exist, but you'll find the create view button at bottom of the page; name it something like orphaned_address_books. It is now up to you to confirm the integrity of the data returned, look at some of the customers_id's in the view, check to see if the same customers_id exist in the customers table - if they DO NOT exist in the customers table then you may proceed. You don't really want to waste time checking each of them if you have a high return, just randomly select a handful to ensure the query returned as expected. Now, using the view you should be able to delete the orphaned rows. By the way ~ YOU did backup the address_book table, right? Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS! Link to comment Share on other sites More sharing options...
tgely Posted February 22, 2015 Share Posted February 22, 2015 When feeling myself in a development enviroment as a blind man running in the city. I use this minimal function in catalog/iincludes/local/configure.php so no conflict with github // my debug functions // display values & exit // function de($v = array('exit')) { echo '<pre>'; print_r($v); echo '</pre>'; exit; } // only display values function d($v = array('exit')) { echo '<pre>'; print_r($v); echo '</pre>'; } osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
Hotclutch Posted July 13, 2015 Share Posted July 13, 2015 I am using Cache, and notice that my bestsellers boxes disappear every once in a while. When the cache files are deleted, the pages work fine again. Came across this useful piece of code in the add-on section. Create a script in the root directory with the following contents and then create a cron job to execute every few hours. <?php $files = glob("includes/work/bm_best_sellers_box-*"); if (!count($files)) { die('No files in cache'); } foreach ($files as $filename) { unlink($filename); } echo 'Cleared cache'; ?> Link to comment Share on other sites More sharing options...
tgely Posted August 1, 2015 Share Posted August 1, 2015 Bootstrap Core Memory Usage add on the top in application_top: // ini_set('memory_limit', '4M'); $memory_start = memory_get_usage(false); Find at the bottom of application_bottom: ?> Change to: $memory_end = memory_get_peak_usage(false); $valuemax = (int)ini_get('memory_limit'); $valuenow = round(($memory_end-$memory_start)/1024/1024/$valuemax, 3)*100; ?> <div class="progress"> <div class="progress-bar" role="progressbar" aria-valuenow="<?php echo $valuenow; ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $valuenow; ?>%;"> <?php echo $valuenow; ?>% </div> </div> osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted August 1, 2015 Share Posted August 1, 2015 I was looking for a way to inspect the microdata using some javascript on page.This page shows a solution in action, that you can add to your codebase,http://krofdrakula.github.io/microdata-tool/but even better, it is also avalable as a bookmarklethttps://gist.github.com/1397528for your use without having to modify your page's source code!Simply visit this pagehttp://jsfiddle.net/peterhost/ZJfpL/14/embedded/result/and drag the link to your bookmark bar and you're set to go. 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...
bonbec Posted August 2, 2015 Share Posted August 2, 2015 Thank's Carine, For the link #2, remove the )f at the end and it will work fine ;) with OsC 2.2 since 2006 ... Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted August 2, 2015 Share Posted August 2, 2015 Thank's Carine, For the link #2, remove the )f at the end and it will work fine ;) Thanks for the heads up, burt corrected the original post for me. 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...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.