Magento 1.9.2 Custom order amount in dashboard

A module I am building which will create a custom order, and everything is ok until I found that the Grand Total was not showing up Last 5 orders in Dashboard.

dashboard

Google again, and I found that there is a property in Order Model must be set in sales_flat_order table. base_to_global_rate must set to 1.0 (I am not sure what the value meant, but 1.0 is the value that when place order normally)

Also, another problem is create custom order and I called setShippingMethod to ‘flatrate_flatrate’, in Order View it did not show up flatrate.

flatrate

Google around again, and I found that I must set Shipping Description in the order, and now it works!

flatrate2

I have embed the Snippet from my code in Gist.

Read More

Magento Custom Module EAV Attribute Table Unique Key

I created a Magento 1.9.2 module with EAV Table for importing custom data, but when I tried to import second time and update the existing data, it created new entries in Attribute table instead of updating it. I searched for awhile finally figure out that the Setup script won’t create unique key (entity_id, entity_type_id, store_id, attribute_id) for my attributes table.

Although I can just use command to add the unique key, I want to do it inside the setup script. End up it is straight forward.

 

Read More

Creating Magento Custom Module with Entity table

I was writing a Magento module and trying to create a custom entity table for my Model.  However, every time I run the installation script, it just create table with name t_xxxxxxx  (x is random number) and the associate attribute tables.  Took me so long to figure out that my config.xml was wrong with this format:

<entities>
<foo>
<table>
foo_entity
</table>
</foo>
</entities>

Turn out that is not correct. I need to put the table name right after the <table>


<entities>
<foo>
<table>foo_entity</table>
</foo>
</entities>

Then it create a table with name ‘foo_entity’

FML for spending so much time to figure this out.

Read More

Chrome Extension Permission URL pattern is malformed

Today I was learning how to create a Chrome Extension App and I got this warning after I set the permission in manifest.json.

Permission ‘http://192.168.1.100’ is unknown or URL pattern is malformed.

After searching for awhile, I finally figure out that I need to add slash at the end.

“permissions”: [
“http://192.168.1.100/”,
“http://192.168.1.101/”
],

And the warning is gone!

Read More

iOS 9 NSURLConnectionSSL error

Today I was testing an app on iOS9 simulator, and got an Error when connecting to Parse.  After doing some research, I found that there is App Transport Security in iOS9.

For now, I am using couple services, so I have read the quick fix for the App now is to add NSAllowsArbitraryLoads into Info.plist.  Add this to your Info.plist for a quick fix, but you should read the document for a better security.

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict>

 

Read More