mysqldump -u root -p databasename > /var/www/html/lospol_3172019.sql
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
Showing posts with label Export. Show all posts
Showing posts with label Export. Show all posts
Wednesday, 31 July 2019
How to export database from terminal / CMD in mysql
Monday, 25 December 2017
Export Big sql/mysql database using php file
Export Big sql/mysql database using php file
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
ini_set('memory_limit', '512M');
$dbinfo = array(
"host" => 'localhost',
"user" => 'root',
"pass" => 'root',
"dbname" => 'dbname'
);
// Database Config
$sqlhost = $dbinfo["host"];
$dbuser = $dbinfo["user"];
$dbpassword = $dbinfo["pass"];
$dbname = $dbinfo["dbname"];
// filename
$file = date('Ymdhis');
echo shell_exec("mysqldump --add-drop-table -u $dbuser -p$dbpassword`cat /etc/psa/.psa.shadow` $dbname > $file.sql");
//shell_exec("mysql -u $dbuser --password='$dbpassword' --host='$sqlhost' $dbname < $file");
echo 'Finished!<br/>';
Thursday, 4 August 2016
Export csv after place order in magento
config.xml
Observer.php
<?xml version="1.0"?>
<config>
<modules>
<Test_Test>
<version>0.1.0</version>
</Test_Test>
</modules>
<global>
<helpers>
<test>
<class>Test_Test_Helper</class>
</test>
</helpers>
<models>
<test>
<class>Test_Test_Model</class>
<resourceModel>test_mysql4</resourceModel>
</test>
</models>
<events>
<checkout_onepage_controller_success_action> <!-- identifier of the event we want to catch -->
<observers>
<checkout_onepage_controller_success_action_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>test/observer</class> <!-- observers class alias -->
<method>exportCsvOnCheckout</method> <!-- observer's method to be called -->
<args></args> <!-- additional arguments passed to observer -->
</checkout_onepage_controller_success_action_handler>
</observers>
</checkout_onepage_controller_success_action>
</events>
</global>
</config>
Observer.php
<?php
class Test_Test_Model_Observer
{
public function exportCsvOnCheckout(Varien_Event_Observer $observer)
{
$orderIds = $observer->getData('order_ids');
$order = Mage::getModel('sales/order')->load($orderIds);
$customer = Mage::getModel('customer/customer')->load($order->getData('customer_id'));
// echo '<pre>';print_r($customer->getName());exit;
$file_path = "order.csv";
$mage_csv = new Varien_File_Csv();
$data = array();
$data['Email'] = $customer->getEmail();
$data['name'] = $customer->getName();
$products_row[] = $data;
$mage_csv->saveData($file_path, $products_row);
}
} }
Subscribe to:
Posts (Atom)