Typically, cache:clean deletes all enabled cache related to magento whereas cache:flush deletes the whole cache storage, whether its magento cache or any third party cache (whether enabled or disabled)
Tag Archives: PHP
Where does all core modules are located in Magento2?
They are under vendor/magento folder.
Put site into a developer mode Magento2
In order to do this, open your terminal and go to the Magento 2 root. From there you should run the following command:
php bin/magento deploy:mode:set developer
MySQL Cursor
A cursor can’t be used by itself in MySQL. It is an essential component in stored procedures. I would be inclined to treat a cursor as a “pointer” in C/C++, or an iterator in PHP’s foreach statement.
With cursors, we can traverse a dataset and manipulate each record to accomplish certain tasks. When such an operation on a record can also be done in the PHP layer, it saves data transfer amounts as we can just return the processed aggregation/statistical result back to the PHP layer (thus eliminating the select – foreach – manipulation process at the client side).
Since a cursor is implemented in a stored procedure, it has all the benefits (and limitations) of an SP (access control, pre-compiled, hard to debug, etc).
MySQL supports cursors inside stored programs. The syntax is as in embedded SQL. Cursors have these properties:
Asensitive: The server may or may not make a copy of its result table
Read only: Not updatable
Nonscrollable: Can be traversed only in one direction and cannot skip rows
Cursor declarations must appear before handler declarations and after variable and condition declarations.
Remove Specific Element From An Array PHP
Following code will help to remove a particular element from an array
<?php
$appliedRuleIs = array(370,369,400,500);
if (($key = array_search(‘369’, $appliedRuleIs)) !== false) {
unset($appliedRuleIs[$key]);
}
?>
Magento Enable Maintenance Mode With IP Filters
Log in to your account using SSH and Change to the directory where you installed Magento.
Run the blow given commands
touch /opt/ocentric/magento/current/maintenance.flag
service httpd restart
Then edit the index.php and assign the IPs to be shiteslited to the array $allowed = array(‘xxx.xxx.xxx.xxx’);
Magento Disable Maintenance Mode
Log in to your account using SSH and Change to the directory where you installed Magento.
Run the blow given command
rm maintenance.flag
service httpd restart
php shell/cache-clear.php -all
Magento Enable Maintenance Mode
Log in to your account using SSH and Change to the directory where you installed Magento.
Run the blow given command
touch maintenance.flag
service httpd restart
Its also possible that we can the website accessible only for some given IPs
For that edit the index.php file and assign teh IPs to the array $allowed = array(‘xxx.xxx.xxx.xxx’);
WordPress Get Menu Items
<?php $topMenuItems = wp_get_nav_menu_items(‘header-top-menu’ ); ?>
<ul>
<?php foreach($topMenuItems as $topMenu) { ?>
<li><a href=”<?php echo $topMenu->url; ?>”><?php echo $topMenu->title; ?></a></li>
<?php } ?>
</ul>
Magento Delete Shopping Basket Items Of Customer
You can delete it using the below query
UPDATE sales_flat_quote SET is_active=0 WHERE customer_id =CUSTOMERID ;