Skip to content

Conversation

Oscar-Wagento
Copy link
Contributor

In order to avoid interrumption of syncronization it have been improved with syncronization scheduled, per 13 minutes it will syncronized 90 customers to zendesk

return;

$user = null;
//$customer = $event->getCustomer();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it will be removed

* Created by PhpStorm.
* User: o5k4r1n
* Date: 29-05-18
* Time: 10:44 AM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment block.

$user = null;
//$customer = $event->getCustomer();
$email = $customer->getEmail();
$orig_email = $customer->getOrigData();
Copy link
Contributor

@joseconsador joseconsador Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this was based from https://github.com/zendesk/magento_extension/blob/master/src/app/code/community/Zendesk/Zendesk/Model/Observer.php#L108 , but moving forward please use camelCase for variable names, to follow the rest of the code.

{
Mage::getModel('zendesk/api_users')->create($info);
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline at the end of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be added

* User: o5k4r1n
* Date: 25-05-18
* Time: 05:10 PM
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it will be removed.

$zendesk_id = $customer_data['id'];
$customer->setZendeskId($zendesk_id);
$customer->save();
//Zend_Debug::dump($customer_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it will be removed.

}
return $user;
}
public function syncData($info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this PR - this function isn't used outside this class. If it's only used here, then let's set it to private.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, setting to private.

$email = $customer->getEmail();
$orig_email = $customer->getOrigData();
$orig_email = $orig_email['email'];
echo "correo: ".$email;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this debug code? if so, please remove thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was a debug code, Dropping now

public function syncronize(){
Mage::log('Cron Working', null, 'cron.log', true);
$customers = Mage::getModel('customer/customer')
->getCollection()->setPageSize(90)->setCurPage(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if a timeout is reached and not all customers have finished syncing? On the next cron run would the sync start from the beginning of the collection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an timeout is reached the syncronization will be made only with customers that doesn't have a zendesk_id (null), if the process is interrupted by any reason, then the syncronization will begin then with the first customer found with no zendesk_id. (zendesk_id = null)
It will not be necessary to start from zero this time.
If the process is interrupted will start again in 10 minutes (for example)

Copy link
Contributor

@joseconsador joseconsador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nitpicks, almost there though 👍

'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'note' => '',
));
$installer->endSetup();*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments


}
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add new line at EOF.

}
return $user;
}
private function syncData($info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line before function.

@Oscar-Wagento
Copy link
Contributor Author

Hi @joseconsador changes are made.

Copy link

@jmramos02 jmramos02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@joseconsador joseconsador merged commit 3345513 into agnostack:master Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants