April 22, 2016 6:39 am
image_round

Magento 1.9.x : reindexing through ssh

Execute reindex using this command

php -f shell/indexer.php reindexall

 
It is possible to get full list of Magento indexer commands using this command

php -f shell/indexer.php help

 
To get a list of available indexes, execute this command

php -f shell/indexer.php info

 

Magento 1.9.x : reindexing through ssh

Execute reindex using this command

php -f shell/indexer.php reindexall

 
It is possible to get full list of Magento indexer commands using this command

php -f shell/indexer.php help

 
To get a list of available indexes, execute this command

php -f shell/indexer.php info

 

April 22, 2016 6:35 am
image_round

Solved: SQL Error: Integrity constraint violation: 1062 Duplicate entry catalogrule_product

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry  query was: INSERT INTO `catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?),

Solution :

Backup the table catalogrule_product.
Truncate it.
Run the reindex process from the command line.
If something goes wrong, just restore you table.

Solved: SQL Error: Integrity constraint violation: 1062 Duplicate entry catalogrule_product

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry  query was: INSERT INTO `catalogrule_product` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`action_operator`,`action_amount`,`action_stop`,`sort_order`,`sub_simple_action`,`sub_discount_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?),

Solution :

Backup the table catalogrule_product.
Truncate it.
Run the reindex process from the command line.
If something goes wrong, just restore you table.

April 20, 2016 11:18 am
image_round

Manually create entries and send notifications with Gravity Forms Programatically

Manually create entries and send notifications with Gravity Forms Programatically

<?php

// Manually create entries and send notifications with Gravity Forms Programatically

$form_id = 10;

// add entry
$entry = array(
  "form_id" => $form_id,
  "1" => "Entry for field ID 1",
  "2" => "Entry for field ID 2"
);

$entry_id = GFAPI::add_entry($entry);

// send notifications
function send_notifications($form_id, $entry_id){

  // Get the array info for our forms and entries
  // that we need to send notifications for

  $form = RGFormsModel::get_form_meta($form_id);
  $entry = RGFormsModel::get_lead($entry_id);

  // Loop through all the notifications for the
  // form so we know which ones to send

  $notification_ids = array();

  foreach($form['notifications'] as $id => $info){

    array_push($notification_ids, $id);

  }

  // Send the notifications

  GFCommon::send_notifications($notification_ids, $form, $entry);

}

send_notifications($form_id, $entry_id);

?>

Manually create entries and send notifications with Gravity Forms Programatically

Manually create entries and send notifications with Gravity Forms Programatically

<?php

// Manually create entries and send notifications with Gravity Forms Programatically

$form_id = 10;

// add entry
$entry = array(
  "form_id" => $form_id,
  "1" => "Entry for field ID 1",
  "2" => "Entry for field ID 2"
);

$entry_id = GFAPI::add_entry($entry);

// send notifications
function send_notifications($form_id, $entry_id){

  // Get the array info for our forms and entries
  // that we need to send notifications for

  $form = RGFormsModel::get_form_meta($form_id);
  $entry = RGFormsModel::get_lead($entry_id);

  // Loop through all the notifications for the
  // form so we know which ones to send

  $notification_ids = array();

  foreach($form['notifications'] as $id => $info){

    array_push($notification_ids, $id);

  }

  // Send the notifications

  GFCommon::send_notifications($notification_ids, $form, $entry);

}

send_notifications($form_id, $entry_id);

?>