WarpConduit Computing

  • Quick Tips
  • Web Development
  • WordPress Plugins
  • Home
  • Passphrase Generator
  • Password Generator
  • About
  • Contact

Automatically Embedding Video Using Only the URL With the Help of oEmbed

April 13, 2013 by Josh Hartman

One of my favorite functions of the WordPress editor is now the automatic embedding of video and other rich media by simply putting the URL on it’s own line. Really, it’s amazing!

Here is my rip of the WordPress code (found in the WP_Embed and WP_oEmbed classes) and assembled into a class named AutoEmbed. [Read more…]

Filed Under: Web Development Tagged With: automatic, class, embed, html, media, photo, php, text, url, video, wordpress

Quick Tip: Profiling PHP Applications with Xdebug, WinCacheGrind & XAMPP for Windows

September 1, 2012 by Josh Hartman

In today’s quick tip screencast you’ll learn how you can profile a PHP application, such as WordPress, using Xdebug and WinCacheGrind on XAMPP for Windows.

View Screencast

Enabling Xdebug on XAMPP for Windows

To enable Xdebug, modify the following settings in your php.ini configuration file:

  • Uncomment the zend_extension = "\xampp\php\ext\php_xdebug.dll" line
  • Set xdebug.profiler_enable_trigger = 1
  • Set xdebug.profiler_output_name = "cachegrind.out.%u.%H_%R"

Save php.ini and restart Apache.

Resources

XAMPP for Windows
WinCacheGrind

Filed Under: Web Development Tagged With: debug, php, profiling, wincachegrind, windows, xampp, xdebug

How to Change the Order Increment ID and Allow Very Large Order Numbers in OpenCart

May 4, 2012 by Josh Hartman

OpenCart Large Order Number Increment IDProblem

I recently found myself needing to set up various stores with very large custom order numbers to avoid conflicting order numbers when centrally processing orders from multiple stores.

Background Information

When OpenCart is installed the tables with order_id columns are setup as datatype INT(11) and by default these columns are signed, meaning they support negative or positive numbers (which doesn’t make any sense for order numbers). As an INT(11) SIGNED column it could contain order numbers up to 2147483647 and if the field was INT(11) UNISGNED it could then contain order numbers up to 4294967295. But for my administrative needs this was still not enough.

Solution

Note: The following method has been tested on OpenCart v1.5.2 only and I can’t say how it will behave on other versions.

Update (7/9/2014): This method does not work on OpenCart v1.5.4+. OpenCart is now converting the large order number into a smaller integer before it is written to the database thereby breaking this method.

First things first, you should take this opportunity to backup your OpenCart database in case something goes wrong.

Allowing Very Large Order Numbers

After eliminating the other integer data types I turned to the BIGINT UNSIGNED datatype which can contain order numbers up to 18446744073709551615.

To make use of this datatype you will need to run some SQL queries to alter some columns in the database schema. If your install has a table prefix setup adjust the queries as necessary.

ALTER TABLE `affiliate_transaction` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `coupon_history` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `customer_reward` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `customer_transaction` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `order_download` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order_fraud` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `order_history` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order_option` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order_product` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order_total` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `order_voucher` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `return` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `voucher` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;
ALTER TABLE `voucher_history` CHANGE COLUMN `order_id` `order_id` BIGINT UNSIGNED NOT NULL;

Setting the Order Increment ID

Now you can the set the order table’s order_id column AUTO_INCREMENT value to a non-negative number between 1 and 18446744073709551615. The SQL command for that follows:

ALTER TABLE `order` AUTO_INCREMENT = 9010003001;

Once again, if your install is using a table prefix, update the query as necessary.

Hopefully in the future the OpenCart developers will recognize that some need to use very large custom order numbers and adjust the install database schema so that we don’t have to hack the tables. But until then this is what works for me.

Filed Under: Web Development Tagged With: bigint, increment, mysql, number, opencart, order

How to Change the Order Increment ID and Prefix in Magento

April 18, 2012 by Josh Hartman

Magento Order NumbersSometimes the need arises where you must change the Magento order numbering. Perhaps it is necessary to avoid conflict with a separate Magento installation or other ecommerce platform. Or maybe you just want to increase your order number to look like you’ve processed hundreds of thousands of orders. Whatever the case may be here are some SQL commands you can run to check the status of your store’s order numbers, and commands to also change the numbering. In addition, I’ve included SQL commands to modify the invoice, shipment, and credit memo increment IDs as well.

Note: These queries were tested on Magento Community Edition v1.6.2.0. I fully expect the increment ID queries to work on v1.4.1 and above, but DO NOT set the increment prefix to NULL on anything less than v1.6.0. Backup your database before making any changes in case your copy of Magento reacts unexpectedly.

Update 12/6/2017: This method has been successfully tested on Magento CE v1.9.3.6.

Find the Current Increment IDs for All Stores

SELECT core_store_group.name as group_name, core_website.name as website_name, core_store.name as store_name, core_store.store_id, increment_prefix, increment_last_id, entity_type_code
FROM eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNER JOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNER JOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNER JOIN core_website ON core_website.website_id = core_store.website_id
WHERE eav_entity_store.store_id != 0 ORDER BY eav_entity_store.store_id;

This will display your current increment ID and prefix for all document types (quotes, orders, invoices, shipments, and credit memos). In addition it will show you the website group, website name, store name, and store ID for each type of increment ID to help you in updating a specific store among multiple stores.
When making changes keep in mind that the increment_prefix field type is varchar(20) and that the increment_last_id field type is varchar(50).

Order Increment ID and Prefix

Change your Order Increment ID on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order';

Replace the X‘s with your desired order number and run the query.

Change your Order Prefix on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='order';

Replace the X with your desired order prefix or remove the quotes and set X to NULL (no quotes) to disable the order prefix, then run the query.

Change your Order Increment ID on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';

Replace the X‘s with your desired order number, replace Y with the store ID of the store you want to modify, then run the query.

Change your Order Prefix on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';

Replace the X with your desired order prefix or remove the quotes and set X to NULL (no quotes) to disable the order prefix, then replace Y with the store ID of the store you want to modify. Run the query.

Invoice Increment ID and Prefix

Change your Invoice Increment ID on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='invoice';

Replace the X‘s with your desired invoice number and run the query.

Change your Invoice Prefix on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='invoice';

Replace the X with your desired invoice prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then run the query.

Change your Invoice Increment ID on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='invoice' AND eav_entity_store.store_id = 'Y';

Replace the X‘s with your desired invoice number, replace Y with the store ID of the store you want to modify, then run the query.

Change your Invoice Prefix on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='invoice' AND eav_entity_store.store_id = 'Y';

Replace the X with your desired invoice prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then replace Y with the store ID of the store you want to modify. Run the query.

Shipment Increment ID and Prefix

Change your Shipment Increment ID on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='shipment';

Replace the X‘s with your desired shipment number and run the query.

Change your Shipment Prefix on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='shipment';

Replace the X with your desired shipment prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then run the query.

Change your Shipment Increment ID on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='shipment' AND eav_entity_store.store_id = 'Y';

Replace the X‘s with your desired shipment number, replace Y with the store ID of the store you want to modify, then run the query.

Change your Shipment Prefix on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='shipment' AND eav_entity_store.store_id = 'Y';

Replace the X with your desired shipment prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then replace Y with the store ID of the store you want to modify. Run the query.

Credit Memo Increment ID and Prefix

Change your Credit Memo Increment ID on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='creditmemo';

Replace the X‘s with your desired credit memo number and run the query.

Change your Credit Memo Prefix on All Stores

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='creditmemo';

Replace the X with your desired credit memo prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then run the query.

Change your Credit Memo Increment ID on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='creditmemo' AND eav_entity_store.store_id = 'Y';

Replace the X‘s with your desired credit memo number, replace Y with the store ID of the store you want to modify, then run the query.

Change your Credit Memo Prefix on a Specific Store

UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='X'
WHERE eav_entity_type.entity_type_code='creditmemo' AND eav_entity_store.store_id = 'Y';

Replace the X with your desired credit memo prefix or remove the quotes and set X to NULL (no quotes) to disable the prefix, then replace Y with the store ID of the store you want to modify. Run the query.

Filed Under: Web Development Tagged With: credit memo, increment, invoice, magento, number, order, prefix, shipment, sql

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 9
  • Next Page »

Connect

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • YouTube

Recent Posts

  • How to Permanently Remove the “Learn about this picture” Spotlight Wallpaper Icon From Your Windows Desktop
  • How to Quickly Test a Fax Machine
  • Extremely Useful Applications for Web Development and IT Tasks

Tags

automatic benchmark bigint class composer css embed escape event font function gzip helper htaccess html htmlspecialchars image increment javascript jquery list magento media mysql number observer opencart order output photo php profiling random redirect rijndael software text type ubuntu url windows windows 7 wordpress xampp xss

Blogroll

  • CodeIgniter
  • Fusion Forward
  • jQuery
  • Nettuts+
  • Smashing Magazine

© 2025 WarpConduit Computing. All Rights Reserved.