Earthtracker's Blog

Just another weblog

CakePHP 3 Sending Email

public function sendemail($to,$from,$from_name,$subject,$message)
        Email::configTransport('SMTP', [
            'host' => 'ssl://',
            'port' => 465,
            'username' => '',
            'password' => 'password',
            'className' => 'Smtp'
        $email = new Email();
        $email->from([$from => $from_name])
Leave a comment »

Enable SSL for virtual host on Apache windows

<VirtualHost *:443>

    DocumentRoot D:/xampp/htdocs/miraiinsiders/content/
    #ErrorLog /var/www/
    #CustomLog /var/www/ combined
    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
Leave a comment »

CakePHP3 Add Datetime for Created / Modified field

$data['created']=new \DateTime('now');
Leave a comment »

CakePHP3 JoinWith passing variables to callback function

Cakephp3 Join: Passing parameters to Call Back Function

function findResult($xx_id)
    $res = $this->Model1
                ->select(['Model1.col_name', 'Model2.col_name'])
                ->leftJoinWith('Model2', function ($q) use ($xx_id) {
                    return $q->where(['Model1.xx_id' => $xx_id);}
Leave a comment »

Configure Virtual Host on XAMPP/WAMPP and access from another PC

This will demonstrate to configure Virtual host on windows PC and access it from another PC.

Open hosts file from \Windows\System32\drivers\etc using Notepad as Administrator

Write the following code:  xxxx.local

Note:xxxx.local your domain or subdomain name

Open httpd-vhosts.conf from xampp\apache\conf\extra

Open httpd-vhosts.conf from wamp\bin\apache\apache2.4.9\conf\extra

Write the following code :

    DocumentRoot "D:/xampp/htdocs/xxxx/"
    ServerName xxxx.local
    ##ErrorLog "logs/"
    ##CustomLog "logs/" common

To use the virtual host from another PC

    DocumentRoot "D:/xampp/htdocs/xxx/"
    ServerName xxxx.local
    <Directory "/">
   # Deny from all
    Allow from
    Allow from
    ##ErrorLog "logs/"
    ##CustomLog "logs/" common

Note: : local pc IP and port
Allow from : IP of the another PC from where you like to access the Virtual host
If you like to allow it from all , use :

    Allow from  all 

Retstart XAMPP / WAMPP


Leave a comment »

CakePHP3 created modified not added automatically

Created / Modified should be added automatically.
if not, please check you used following behavior in Model->Table:

public function initialize(array $config)

Leave a comment »

Change Domain root to specific folder

write htaccess file on current root.

RewriteCond %{REQUEST_URI} !domain/
RewriteRule (.*) /folder/$1 [L]

Leave a comment »

শহিদ আজাদ এর মা কে নিয়ে লিখা আনিসুল হক এর মা উপন্যাস

Download Maa-Anisul-hoq

Leave a comment »

Magento 2.1.5 Assets Missing after installation

Remove everything, except .htaccess file from pub/static folder

Open up app/etc/di.xml find the path “Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink” and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Leave a comment »

Magento Canonical URL problem from outside of main category solve

In magento , if you add a product in categories multiple categories, and like to display product from outside of the categories, it will no reflect the correct url, it will create a url with the domain name + product url title,It will cause duplicate contents in google, to resolve the problem, here is the solution,My special thanks to



   if($_categories[0]==2) // here 2 is root category id




   $_categories = $_product->getCategoryIds();

   $_category = Mage::getModel('catalog/category')->load($_categories[$cat_count]); 

   $caturl=explode('.html', $_category->getUrlPath());      
   $product_url = Mage::getUrl($caturl[0]).basename($_product->getProductUrl()); 

Leave a comment »