Saturday, October 31, 2020

Laravel Permissions

 As per laravel docs:
----------------------
Directory Permissions

After installing Laravel, you may need to configure some permissions. Directories within the storage
and the bootstrap/cache directories should be writable by your web server or Laravel will not run.

Solution:
--------------
step1 - setting root directory owner and group
-------

sudo chown -R ubuntu:www-data /path/to/your/laravel/root/directory

step2 - setting file and folder permissions:
-------

sudo find /path/to/your/laravel/root/directory -type f -exec chmod 664 {} \;    
sudo find /path/to/your/laravel/root/directory -type d -exec chmod 775 {} \;

step3 - then give the webserver the rights to read and write to storage and cache
-------

sudo chgrp -R www-data storage bootstrap/cache

step4 - then you need to give read and write permissions to the webserver for storage, cache and any other directories the webserver needs to upload or write too
-------

sudo chmod -R ug+rwx storage bootstrap/cache

Now, you're secure and your website works, AND you can work with the files fairly easily



Wednesday, November 18, 2015

Magento 2.0 is live now

Well, the long stay for Magento 2.0 is over. Its 1:37 am on November 18, 2015 in India and i am receiving notification email from Magento that Magento 2.0 is available to be downloaded from Magento Download Page. I am starting the tutorials for Magento 2.0 on this blog with more frequent posts. Keep in touch for latest updates for Magento 2.0.

Friday, August 7, 2015

Add profile picture for customer in magento


I got a requirement from client to enable customers to upload their profile picture (Avataar Image) in Magento from my account section. I tried to build a custom module but didn't have much time to do that. The client also needed functionality to enable customers to crop their image too. Luckily i googled and came across a fantastic extension that provided all that i needed. The extension can be downloaded from here . It really saved at least 15-20 hours of my effort.

Friday, April 24, 2015

Reminder: Download and install Magento security patches. Download now.

You need to download two files from https://www.magentocommerce.com/products/downloads/magento/ 1) SUPEE-5344 2) SUPEE-1533 These two are security patches for magento that addresses potential remote code execution exploits. To execute these two files you need to download both files and upload to root directory of your Magento Installation. Then through ssh execute below commands: sh name-of-file1.sh sh name-of-file2.sh Replace "name-of-file1.sh" and "name-of-file2.sh" with the real filenames downloaded.

Friday, May 30, 2014

Magento #1146 - Table doesn't exist

Magento #1146 - Table doesn't exist. I faced a very irritating issue. When i logged in phpmyadmin and looked at a table in left column the table shows. But when i try to open that table by clicking on it , it throws error "#1146 - Table `DB NAME.tag_summary` doesn't exist "

I tried to drop the table and create the table agian but it throws same error "#1146 - Table `DB NAME.tag_summary` doesn't exist".

Below is the solution:

You would need to access the server via SSH and after that navigate to /var/lib/mysql and go to the database folder.

For eg: cd /var/lib/mysql/DATABASE Folder and then delete the table using

rm -rf DB NAME.tag_summary

rm -rf DB NAME.tag_summary.ibd

rm -rf DB NAME.tag_summary.frm

Then connect to mysql by using the command mysql and follow the below steps:

use DB NAME;

DROP TABLE DB NAME.tag_summary;

Thursday, May 15, 2014

Magento CE 1.9.0.0 Released

While we are eagerly waiting for Magento 2.0 , Magento has released its latest CE Magento CE 1.9.0.0 . Most store owners used to complain about why Magento donot provide responsive theme by default. To an extent this was a question that often haunted my mind too. With this release Magento has addressed to this requirement and provided default Responsive theme. The changelog of the latest version can be viewed Here .
With the launch of new version now there will be rush to upgrade all magento stores to latest version and rightly it should be as many security updates are  also added  to make Magento more secure.

Wednesday, March 12, 2014

Why we use Antivirus?

Why we use Antivirus?

Many users think that we can get viruses by downloading files,visiting wrong websites and clicking irresponsible things.It's true-this is how we pick viruses, but it is not the only way we pick up viruses,but it is not the only way viruses spread out.Our computer sometime may be infected just from visiting a website or by putting some other external devices e.g.U.S.B,Harddisk etc.
 
In the leading world of globalisation people trust on computers and internet to send,receive and manage their valuable informations.The term protection is prior word which comes to their mind when using interne, as the informations sent over network has many risks from the devil malwares who are responsible for hampering the information on internet.So it is important for the user to protect their computers from risk.

One of the best solution  to this problem is antivirus.An antivirus programs protects your computer from the viruses by identifying and removing it.Now these days antivivirus more often comes with firewall packages that blocks the unwanted things and ptotects your computer.Antivirus automatically scans your files downloaded from the web,email attachments and all types of removable cables  inserted in the computer.It also removes  malicious .malwares like viruses.Thus making you to feel free to send all your informations.
 
To prevent our system from the unwanted malware or viruses,we need a software that is know as antivirus.It is used to prevent,detect and remove malicious computer viruses from your computer.Software described viruses from computer.Software described as antivirus also works against different types of malware e.g rootkit,trojan horses,worms and spywares etc.

Updating the antivirus programs regularly is important because it will download an new virus definitation that have been added since last update
 
 

Tuesday, January 28, 2014

Lamp install on Ubuntu with few clicks

Easiest way to install Lamp Server i have found after googling for 2 hours.
I thought to share with you so you can also get benefit from it.

sudo apt-get install tasksel
sudo tasksel install lamp-server

After you will be prompted to enter mysql root password . Enter the root password for Mysql and press enter.
It will install most rexommended php modules.
 
 
If you want to install phpmyadmin run below command:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
  
-----------------------------------------Enjoy-----------------------------------------------------

Saturday, December 21, 2013

Excel extarct words before and after a specific word

Excel extarct words before and after a specific word

For example, you have the following text in a cell “A1″ and you’d like to extract the text before the comma (the last name):
“Alam, Afroz”
To extract the last name before the comma “Alam” from A1, use one of the following formula:
=LEFT(A1,(FIND(",",A1,1)-1))
The result: Alam
To extract the first name after the comma from A1, use one of the following formula:
=MID(A1,FIND(",",A1)+2,256)
The result: Afroz

Friday, December 20, 2013

Compare data in Excel in two columns to find duplicates

Compare data in Excel in  two columns to find duplicates

To use a formula to compare the data in two columns:

  1. In a new worksheet, enter the following data (leave column B empty):
    X1: 1   Y1:     Z1: 3
    X2: 2   Y2:     Z2: 5
    X3: 3   Y3:     Z3: 8
    X4: 4   Y4:     Z4: 2
    X5: 5   Y5:     Z5: 0
         
  2. Type the following formula in cell B1:
    =IF(ISERROR(MATCH(X1,$Z$1:$Z$5,0)),"",X1)
  3. Select cells Y1:Y5.
  4. The duplicate numbers are displayed in column B, as in the following example:
     
    X1: 1   Y1:      Z1: 3
    X2: 2   Y2:2     Z2: 5
    X3: 3   Y3:3     Z3: 8
    X4: 4   Y4:      Z4: 2
    X5: 5   Y5:5     Z5: 0 
     
         

Thursday, December 12, 2013

Import large database from command line in windows

Import large database from command line in windows

Use
gzip -d [DATABASE_FILE.SQL.GZ]
to unzip .sql.gz 

If you are in the command prompt, type there
CD C:\wamp\bin\mysql\mysql5.1.36\bin {you can replace mysql5.1.36 with your version of mysql}
mysql -u [DATABASE_USERNAME] -p [DATABASE_NAME] < [DATABASE_FILE.SQL]


From the mysql console:
mysql> use DATABASE_NAME;
mysql> source path/to/file.sql;

Friday, May 3, 2013

Magento : Change options of configurable product to radio button

Magento : Change options of configurable product to radio button

Replace the configurable.phtml code with below code:
<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
            <div class="input-box">
                <select style="display:none;" name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                   
                  </select>
              </div>
        </dd>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>
<div id="r"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#attribute<?php echo $_attribute->getAttributeId() ?> option").each(function(i, e) {
    if(jQuery(this).val() == '')
    {}
    else
    {
    jQuery("<input type='radio' name='r' />")
        .attr("value", jQuery(this).val())
        .attr("checked", i == 0)
        .click(function () {
            jQuery("#attribute<?php echo $_attribute->getAttributeId() ?>").val(jQuery(this).val());
        })
        .appendTo("#r");
        jQuery("<span >&nbsp;&nbsp;&nbsp;"+jQuery(this).html()+"&nbsp;&nbsp;&nbsp;</span>")
        .appendTo("#r");
    }
       
});
});


</script>

Monday, September 17, 2012

Magento : Change page layout from controller

 Change page layout from controller in Magento



Just you need to replace one line of code in your controller
where you want to change the layout of the page if you are not
able to do from xml through setlayout.

Replace
$this->loadLayout();

with
$this->loadLayout()->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');

Monday, September 10, 2012

Magento : Category Flat Data index error


 When reindexing "Category Flat Data " gives error
Cannot initialize the indexer process.

 I run the below query and the issue resolved.

ALTER TABLE catalog_category_entity ENGINE=INNODB;
ALTER TABLE core_store ENGINE=INNODB;

:)

Sunday, September 2, 2012

Magento Installation Linux/Ubuntu : Enable curl


Magento Installation Linux/Ubuntu : Enable curl

If you get error "curl cannot be loaded"  just run the below command in your linux terminal and the error will disappear.



sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Monday, August 27, 2012

Magento : Get all options of a dropdown or multiselect attribute

Magento : Get all options of a dropdown or multiselect attribute

$arg_attribute = "manufacturer";//this may be any attribute code

//Object of attribute model

$attribute_model = Mage::getModel('eav/entity_attribute');

//Object of attribute options model

$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;

//

$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);

$attribute = $attribute_model->load($attribute_code);

$attribute_table =$attribute_options_model->setAttribute($attribute);

//Getting all options

$options = $attribute_options_model->getAllOptions(false);

//Printing all options of particular attribute

echo "<pre />";

print_r($options);

Tuesday, August 21, 2012

Magento : Product list page wrong sorting by price

Magento : Product list page wrong sorting by price

When we install webtex_customergroupprice it has a bug when it sorts products

on product list page it is not correct. For this we need to change collections orderby.

We add

$collection->getSelect()->reset(Zend_Db_Select::ORDER)->order('(min_price)'.$orderDir);

at the end of the function public function sortByPrice() in file "app/code/local/Webtex/Customer

GroupsPrice/Model/Observer.php".

Refresh Cache and the sorting is perfect.

Enjoy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thursday, August 9, 2012

Magento : Ecommerce Tracking google analytics

Ecommerce Tracking google analytics magento

Code for sales conversion tracking in magento.

Add below code to the end of the success.phtml file in Magento

<?php
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
$subtotal = $order->getSubtotal();
$order_id = $order->getId(); //the id of the order
//$order->getIncrementId();//the increment id of the order
$gtotal = $order->getGrandTotal();//grand total of the order
$address = $order->getBillingAddress()->getData();
$city = $address['city'];
$state = $address['region'];
$country = $address['country_id'];
?>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17916440-1']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_addTrans',
    '<?php echo $order_id; ?>',           // order ID - required
    'steigerhoutstunter.nl',  // affiliation or store name
    '<?php echo $gtotal;?>',          // total - required
    '0',           // tax
    '0',              // shipping
    '<?php echo $city;?>',       // city
    '<?php echo $state;?>',     // state or province
    '<?php echo $country;?>'             // country
  ]);

<?php
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($items as $itemId => $item)
{?>

 _gaq.push(['_addItem',
    '<?php echo $order_id; ?>',                // order ID - required
    '<?php echo $item->getSku(); ?>',          // SKU/code - required
    '<?php echo $item->getName(); ?>',         // product name
    'category name',                           // category or variation
    '<?php echo $item->getPrice(); ?>',        // unit price - required
    '<?php echo $item->getQtyToInvoice(); ?>'  // quantity - required
  ]);
<?php
}
?>
  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

Sunday, August 5, 2012

Magento : Show guest name in last 5 orders magento admin dashboard


Show guest name in last 5 orders magento admin dashboard

On the magento community admin dashboard, Under "Last 5 orders" if there is an order by guest it doesnot show the name of guest customer. There were many instances when my clients wanted to show the names of guest too.
For this i have some suggestions. We can show the name from billing address there instead of the customer name. If you think my suggestion is feasible, i request to add this modification to the coming release of magento.
I have coded for this
In Mage/Adminhtml/Block/Dashboard/Orders/Grid.php about line '51' replace "->joinCustomerName('customer')"  with ->joinCustomerBName('customer')
and  in Mage/Reports/Model/Resource/Order/Collection.php

 add a function
 public function joinCustomerBName($alias = 'name')
    {
        $fields      = array('t2.firstname', 't2.lastname');
        $fieldConcat = $this->getConnection()->getConcatSql($fields, ' ');
        $this->getSelect()
        ->join(array('t2' => 'sales_flat_order_address'),'main_table.billing_address_id = t2.entity_id')->columns(array($alias => $fieldConcat));
       

        return $this;
    }

Thursday, July 5, 2012

Magento 1.6.1.0 : Custom option values not displaying at Orders in the Admin Page

In Magento 1.6.1.0 , when a product with custom option is ordered, the custom option values which are selected by customer do not display in  Orders in the Admin Page.( Sales >> Orders ). Also it is not displayed in the Invoice too.
But the values are visible at the order mails . Also when we will try to edit the order at Admin Orders itself, we will be able to see the values which are chosen by custome.

A simple solution to fix this bug:

Comment this line
<?php //$_option = $this->getFormattedOption($_option['value']); ?>

at line 44
in file "/app/design/adminhtml/default/default/template/sales/items/column/name.phtml"


ENJOY!!!!!!!!!