How to setup swagger and generate api and client from spec

August 10, 2017

How to setup swagger editor and UI:
https://github.com/nazmulb/swagger

How to generate your api and client from swagger spec:
https://github.com/nazmulb/swagger/tree/master/api

Advertisements

Simple way to setup nightwatch.js and some test code

August 10, 2017

Very simple way to setup nightwatch.js:
https://github.com/nazmulb/nightwatch.js

Some test code: https://github.com/nazmulb/nightwatch.js/tree/master/tests/learning


Step by step learning: Redux-Saga

April 5, 2017

I hope, it will be useful for beginners in `redux-saga` that I come with a small doc.

Please visit: https://github.com/nazmulb/react.js#redux-saga


Step by step learning: Webpack, React.js & Redux

March 10, 2017

For Webpack: https://github.com/nazmulb/webpack

For React & Redux: https://github.com/nazmulb/react.js

React & Redux Lifecycle:

React & Redux Lifecycle

React & Redux Lifecycle


Step by step learning with a small project: node.js, express.js & mongodb

January 4, 2017

https://github.com/nazmulb/node.js

– Please use https://github.com/nazmulb/node.js/blob/master/Setup.txt to setup your environment.
– Please use https://github.com/nazmulb/node.js/tree/master/learning for step by step learning.
– Please use https://github.com/nazmulb/node.js/tree/master/projects/myapp to see the project.

FYI: I used ES6 instead of raw javascript.

Thanks and happy learning 🙂


How to show top selling products on home page in Megento

May 17, 2010

<?php
$visibility = array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
);

$storeId = Mage::app()->getStore()->getId();
$_productCollection = Mage::getResourceModel(‘reports/product_collection’)
->addAttributeToSelect(‘*’)
->addOrderedQty()
->addAttributeToFilter(‘visibility’, $visibility)
->setOrder(‘ordered_qty’, ‘desc’);
?>
<?php foreach ($_productCollection as $_product): ?>
<!– show as you want name, image, etc –>
<a href=”<?php echo $_product->getProductUrl() ?>” title=”<?php echo $this->htmlEscape($_product->getName()) ?>”><?php echo $this->htmlEscape($_product->getName()) ?></a><br />
<?php endforeach ?>


Setup Magento on IIS

May 17, 2010

Step 1: Create a new folder called magento under C:\Inetpub\wwwroot, then copy and put all the files into that folder.

Step 2: Right-click on the newly created magento folder and click on Properties. Then, click on the Security tab. Give full permission to this folder. See below.

Step 3: Please prepare the database now using the .sql file. If you need to change any database configuration settings, please open the C:\Inetpub\wwwroot\magento\app\etc\local.xml file for editing.

Step 4: Using any database editor, please open the database table core_config_data and change two path values

path = web/secure/base_url

value = http://nazmul.asthait.com/magento/

and

path = web/secure/base_url

value = http://nazmul.asthait.com/magento/

In both cases, the value http://nazmul.asthait.com/magento/ should be changed.

Note: You should delete all the files and folders under C:\Inetpub\wwwroot\ magento \var\cache in order to prevent unwanted cache problems.  See below.

Step 5: This is the most important step for running a Magento project under IIS.

Please download ISAPI_Rewrite3_0073_Lite.msi from http://www.helicontech.com/download-isapi_rewrite3.htm

See below.

Install this software.

IIS will be automatically restarted after installation.

Verify if the installation was successful by opening up the IIS Manager. Right-click on Web Sites and select Properties. You should now have a new tab if installation was successful. See the screenshot below for reference.

ISAPI Rewrite filter has been successfully installed, but we are not done yet. Your httpd.conf file should be empty, so we need to put some rewrite rules in it. The following lines are taken from the .htaccess file in the root of your Magento installation (that is, the website’s root folder), and put into the httpd.conf file.

So click on Edit, and then you have got a chance to add the following code.

RewriteEngine on

RewriteBase /magento/

RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

See the screenshot below for reference.

Now press Apply (top-left corner of the editor).

You’re done configuring the ISAPI Rewrite filter and can now run the Magento project.