Skip to content

Instantly share code, notes, and snippets.

View WaximeA's full-sized avatar
🤷‍♂️

Maxime AVELINE WaximeA

🤷‍♂️
View GitHub Profile
@WaximeA
WaximeA / remove_products_magento.sql
Created February 9, 2018 08:35
SQL script that remove all products in Magento application
-- Reset all products
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE catalog_product_bundle_option;
TRUNCATE catalog_product_bundle_option_value;
TRUNCATE catalog_product_bundle_price_index;
TRUNCATE catalog_product_bundle_selection;
TRUNCATE catalog_product_bundle_selection_price;
TRUNCATE catalog_product_bundle_stock_index;
TRUNCATE catalog_product_enabled_index;
TRUNCATE catalog_product_entity;
@WaximeA
WaximeA / install-1.0.0.php
Last active February 9, 2018 09:12
Setup file to add attribute programmatically in Magento (Codepool/Namespace/Modulename/sql/setup_directory/install_file.php)
<?php
/** @var Mage_Eav_Model_Entity_Setup $installer */
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
// Adding customs attributes
$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'attribute_code', [
'input' => 'textarea',
'type' => 'text',
@WaximeA
WaximeA / reindex_manually.md
Created February 12, 2018 15:29
Reindex all magento data manually

How to reindex all data from terminal in magento

  1. Go to your project root folder and run the command bellow :

if you want to reindex all data : $ php shell/indexer.php --reindexall

if you want to reindex specific index : $ php shell/indexer.php info to show all index's name $ php shell/indexer.php --reindex index_name

@WaximeA
WaximeA / symfony_usefull.md
Created February 20, 2018 14:09
Usefull commands for Symfony
@WaximeA
WaximeA / override_controllers.md
Last active March 23, 2018 14:53
Override controllers in magento

Override controllers in magento :

For example, you want to override Netresearch_OPS controller (Ingenico Payment free module) :

  1. Create or use an existing module in the local codepool

  2. Add in the frontend the routers node in the module config file :

<routers>
@WaximeA
WaximeA / phpliteadmin_in_symfony.md
Last active April 4, 2018 20:02
Use phpLiteAdmin in symfony

Use PhpLiteAdmin in Symfony :

  1. Download PhpLiteAdmin on the official website : https://www.phpliteadmin.org/download/

  2. Add dowloaded files in a web/phpLiteAdmin/ folder

  3. Create new sqlite.db file in app/

  4. Change $directory default value to '../../app/' in phplite.php file

@WaximeA
WaximeA / sql_memory_aid.md
Created April 12, 2018 08:46
SQL memory-aid

How to truncate a foreign key constrained table?

$ SET FOREIGN_KEY_CHECKS = 0; 
$ TRUNCATE table table_name; 
$ SET FOREIGN_KEY_CHECKS = 1;
@WaximeA
WaximeA / ionic_usefull.md
Created April 22, 2018 16:51
Usefull commands for Ionic

General

Run ionic project with lab and consol :

$ ionic serve -lc

Pages

@WaximeA
WaximeA / symfony_usefull.md
Last active May 4, 2018 08:56
Usefull commands for Symfony

Retrive model data

    const MODEL_PATH = 'path in init of the construct method in Module/Model/Modelname.php';

    /**
     * @param null $storeId
     *
     * @return string
     */
 public function getModelData($storeId = null)