Recreate Cazbah legacy platform’s product table in MySQL

CREATE TABLE products (
productActive bit(1),
productCategoryname varchar(500),
productSku varchar(500),
productName varchar(500),
productLongdesc text,
productPrice  double,
productMSRPActive bit(1),
productMSRPLabel varchar(500),
productMSRPPrice  double,
productMSRPSeparator varchar(500),
productMSRPColor varchar(500),
productWeight double,
productShipprice  double,
productFreeshipping bit(1),
productPic varchar(500),
productPicurl varchar(500),
productPiclink varchar(500),
productSubtitle varchar(500),
productThumbnailPic varchar(500),
productThumbnailurl varchar(500),
productDisplayOrder int,
productTrackInventory bit(1),
productCurrentInventory double,
productVariablePricing bit(1),
variationSku varchar(500),
variationDisplayName varchar(500),
variationInvoiceName varchar(500),
variationPrice double, 
variationMSRPActive bit(1),
variationMSRPLabel varchar(500),
variationMSRPPrice double, 
variationMSRPSeparator varchar(500),
variationMSRPColor varchar(500),
variationWeight double,
variationShipprice double,
variationPicUrl varchar(500),
variationActive bit(1),
variationFreeshipping bit(1),
variationDisplayOrder int,
variationTrackInventory bit(1),
variationCurrentInventory double,
variationVariablePricing bit(1),
questionWording varchar(500),
questionDisplayOrder int,
questionAnswerRequired bit(1),
questionDropDownAnswers bit(1),
questionPriceChange double,
questionLongText text,
answersDisplayName varchar(500),
answersInvoiceName varchar(500),
answersDisplayOrder int,
answersPriceChange double,
googleCategory text,
productGglProdCondition varchar(500),
productGglOnlineOnly bit(1),
productGglGTIN varchar(500),
productGglMPN varchar(500),
productGglBrand varchar(500),
productGglColor varchar(500),
productGglSize varchar(500),
productGglMaterial varchar(500),
productGglPattern varchar(500),
productGglAgeGroup varchar(500),
productGglGender varchar(500),
choiceGglProdCondition varchar(500),
choiceGglVariant bit(1),
choiceGglOnlineOnly bit(1),
choiceGglGTIN varchar(500),
choiceGglMPN varchar(500),
choiceGglBrand varchar(500),
choiceGglColor varchar(500),
choiceGglSize varchar(500),
choiceGglMaterial varchar(500),
choiceGglPattern varchar(500),
choiceGglAgeGroup varchar(500),
choiceGglGender varchar(500)
);

WooCommerce 2.3.8 – how to set minimum order amount for a product

It’s not uncommon to be asked to implement minimum checkout requirements to WooCommerce Cart. The common requirements are:

  • Minimum Dollar Amount Per Order
  • Minimum Number of Products Per Order or Per Products

Luckily, there is a great tutorial for implementing these by Yojance Rabelo.

But the other day, I got a request to implement minimum dollar amount PER PRODUCT…not too common, but not never-heard-of either.

So I decided to tweak Yojance’s Minimum Dollar Per Order code to set minimum order amount for a product instead of for the entire order: Continue reading “WooCommerce 2.3.8 – how to set minimum order amount for a product”

Make PHP Mail() work in AWS EC2 – Ubuntu 14.04

AWS IP addresses can be problematic for setting an email server in an EC2 instance…even with right setup email sent from the IP address can be marked as spam.

So what to do with setting up SMTP for your web applications? One alternative is to use AWS SES service. I decided not to use SES, however, because 1) each email address or domain needs to be approved and 2) there is cost associated with number of email sent out. These aren’t too bad of the restrictions but I wanted something that JUST work without configuring every time I build a website.

I went with MSMTP to use my gmail account to send email message by default. I can also overwrite the smtp setting per linux account. So if I were to host sites that are not mine, they can use their own smtp setup.
Continue reading “Make PHP Mail() work in AWS EC2 – Ubuntu 14.04”

Problem with linking models containing multiple words in CakePHP

I had two models, “Example” and “ExampleModel”, linked with belongsTo – hasMany relationship.

The problem was, after baking, the dropdown selection for ExampleModel in Example’s add and view pages were totally blank. Yet, in the index page, the data is shown (which means that relationship is established correctly). Continue reading “Problem with linking models containing multiple words in CakePHP”

Chromebook basic tweaks and tips for Crouton

Here are the first set of basic applications that I installed in my Ubuntu environment. All the applications (including Ubuntu OS) took about 2 GB of disk space.  If you are NOT planning to use Ubuntu on regular basis ,and just wanted to install essential applications that are not available in Chrome OS, the default 16GB of disk space is more than enough to install all for the following applications.
Continue reading “Chromebook basic tweaks and tips for Crouton”

WooCommerce 2.1.9 cheatsheet – product listing page

How To Change Number Products Displayed Per Page

Insert the following code in your theme’s functions.php

// Display 40 products per page. 
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 40;' ), 20 );

Continue reading “WooCommerce 2.1.9 cheatsheet – product listing page”

WooCommerce 2.1.9 cheatsheet – single product page

How To Remove Related Products

Add the following code to your theme’s functions.php

//remove related products from single product page
remove_action ( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);

Continue reading “WooCommerce 2.1.9 cheatsheet – single product page”

Chromebook for a web developer, is that possible?

I purchased my first Chromebook. My new personal laptop.

I wanted something new. I wanted a laptop. I wanted a SSD. What I didn’t have was money in my bank accounts.

I went back and forth thinking “it may be worth inventing on a high-end device and keep it for a long time” and “who am I kidding I can’t keep any gadget for more than two years.” Continue reading “Chromebook for a web developer, is that possible?”

Republic Wireless – making the decision to switch

After four years with Verizon Wireless, I decided to give Republic Wireless a try. Their monthly plan would cut my cost significantly.

Our cellphone bill was average of $80 per month per line. Switching just one line reduce the cost by, at least, half even with the priciest plan Republic Wireless offer.

But before making the decision, there are things to consider. Continue reading “Republic Wireless – making the decision to switch”

Bare-bone CSS horizontal navigation with dropdown

Let’s see if I can make this tutorial simply and easy. The tutorials out there are lengthy and cluttered with non-essential elements to make the example visually pleasing. I wanted to make mine BARE MINIMUM so that I can see what CSS property are actually make the structure.

Key elements for HTML code:

  • Top level menu’s UL tag – “top” class assigned
  • Second level menu’s UL tags -“sub” class assigned

Key Elements for CSS:

  • margin and padding reset – Browsers applies 16px to top- and bottom- margin, and 40px to left-padding. Let just get rid of those so you are not confused.
  • list-style – make the bullet go away. It just looks too broken when they are there (this is NOT a contrubuting CSS property to make the horizontal nav structure)
  • inline-block on ul.top > li – This HAs to be “inline-block”. Can’t be inline, can’t be block. Well, technicially it will work okay with just “inline” under Chrome browser, but messes them up with IE and FireFox.
  • relative on ul.top > li – again this HAS to be “relative”. Making this element “relative” forces the “absolute” position of the submenu origin point to be this element .
  • absolute on ul.sub – making it “absolute” will not interfere the flow of ul.top > li.

So this will get you started on building a horizontal navigation with drop down menu. Of course, this is just a starting point. You will need to decorate them, size them, position them, and add some behaviors to make it fully functional. But now you know which properties are being used to make the navigation structure.