本文整理汇总了PHP中Mage_Core_Model_Abstract::getCustomerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getCustomerId方法的具体用法?PHP Mage_Core_Model_Abstract::getCustomerId怎么用?PHP Mage_Core_Model_Abstract::getCustomerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getCustomerId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getAlertRow
protected function _getAlertRow(Mage_Core_Model_Abstract $object)
{
if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
$sql = $this->_getWriteAdapter()->select()->from($this->getMainTable())->where('customer_id=?', $object->getCustomerId())->where('product_id=?', $object->getProductId())->where('website_id=?', $object->getWebsiteId());
return $this->_getWriteAdapter()->fetchRow($sql);
}
return false;
}
示例2: _getAlertRow
/**
* Retrieve alert row by object parameters
*
* @param Mage_Core_Model_Abstract $object
* @return array|bool
*/
protected function _getAlertRow(Mage_Core_Model_Abstract $object)
{
$adapter = $this->_getReadAdapter();
if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
$select = $adapter->select()->from($this->getMainTable())->where('customer_id = :customer_id')->where('product_id = :product_id')->where('website_id = :website_id');
$bind = array(':customer_id' => $object->getCustomerId(), ':product_id' => $object->getProductId(), ':website_id' => $object->getWebsiteId());
return $adapter->fetchRow($select, $bind);
}
return false;
}
示例3: _afterLoad
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getCustomerId()) {
$cust = Mage::getModel("customer/customer")->load($object->getCustomerId());
if ($cust) {
Mage::helper('remarketing')->setGroupNameAndGenderNameForCustomer($cust);
$object->setCustomer($cust);
}
}
if ($object->getId()) {
$this->loadEmails($object);
$this->loadClicks($object);
}
return parent::_afterLoad($object);
}
示例4: _afterLoad
/**
* Inflate session object
*
* @param Listrak_Remarketing_Model_Session $object Session
*
* @return Listrak_Remarketing_Model_Session
*/
protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
if ($object->getCustomerId()) {
/* @var Mage_Customer_Model_Customer $customer */
$customer = Mage::getModel("customer/customer")->load($object->getCustomerId());
if ($customer) {
/* @var Listrak_Remarketing_Helper_Data $helper */
$helper = Mage::helper('remarketing');
$helper->setGroupNameAndGenderNameForCustomer($customer);
$object->setCustomer($customer);
}
}
if ($object->getId()) {
$this->loadEmails($object);
$this->loadClicks($object);
}
return parent::_afterLoad($object);
}
示例5: loadByProduct
public function loadByProduct(Mage_Core_Model_Abstract $object, $product)
{
$read = $this->_getReadAdapter();
if ($product instanceof Mage_Catalog_Model_Product) {
$productId = $product->getId();
} else {
$productId = (int) $product;
}
$select = $read->select()->from($this->getMainTable())->where('product_id=?', $productId)->where('visitor_id=?', $object->getVisitorId());
if ($object->getCustomerId()) {
$select->where('customer_id=?', $object->getCustomerId());
}
$data = $read->fetchRow($select);
if (!$data) {
return false;
}
$object->setData($data);
$this->_afterLoad($object);
return true;
}
示例6: _afterLoad
public function _afterLoad(Mage_Core_Model_Abstract $object){
$webform = Mage::getModel('webforms/webforms')->load($object->getData('webform_id'));
$fields_to_fieldsets = $webform->getFieldsToFieldsets();
$select = $this->_getReadAdapter()->select()
->from($this->getTable('webforms/results_values'))
->where('result_id = ?', $object->getId());
$values = $this->_getReadAdapter()->fetchAll($select);
foreach($values as $val){
$object->setData('field_'.$val['field_id'],$val['value']);
}
$object->setData('ip',long2ip($object->getCustomerIp()));
if($object->getCustomerId()){
$object->setData('customer',Mage::getModel('customer/customer')->load($object->getCustomerId())->getName());
} else {
$object->setData('customer',Mage::helper('webforms')->__('Guest'));
}
return parent::_afterLoad($object);
}
示例7: _beforeSave
/**
* Before save action
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) {
if ($row = $this->_getAlertRow($object)) {
$object->addData($row);
$object->setStatus(0);
}
}
if (is_null($object->getAddDate())) {
$object->setAddDate(Mage::getModel('core/date')->gmtDate());
$object->setStatus(0);
}
return parent::_beforeSave($object);
}
示例8: _afterSave
/**
* Perform actions after object save
*
* @param Varien_Object $object
* @return Mage_Review_Model_Resource_Review
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$adapter = $this->_getWriteAdapter();
/**
* save detail
*/
$detail = array('title' => $object->getTitle(), 'detail' => $object->getDetail(), 'nickname' => $object->getNickname());
$select = $adapter->select()->from($this->_reviewDetailTable, 'detail_id')->where('review_id = :review_id');
$detailId = $adapter->fetchOne($select, array(':review_id' => $object->getId()));
if ($detailId) {
$condition = array("detail_id = ?" => $detailId);
$adapter->update($this->_reviewDetailTable, $detail, $condition);
} else {
$detail['store_id'] = $object->getStoreId();
$detail['customer_id'] = $object->getCustomerId();
$detail['review_id'] = $object->getId();
$adapter->insert($this->_reviewDetailTable, $detail);
}
/**
* save stores
*/
$stores = $object->getStores();
if (!empty($stores)) {
$condition = array('review_id = ?' => $object->getId());
$adapter->delete($this->_reviewStoreTable, $condition);
$insertedStoreIds = array();
foreach ($stores as $storeId) {
if (in_array($storeId, $insertedStoreIds)) {
continue;
}
$insertedStoreIds[] = $storeId;
$storeInsert = array('store_id' => $storeId, 'review_id' => $object->getId());
$adapter->insert($this->_reviewStoreTable, $storeInsert);
}
}
// reaggregate ratings, that depend on this review
$this->_aggregateRatings($this->_loadVotedRatingIds($object->getId()), $object->getEntityPkValue());
return $this;
}
示例9: getModelVars
/**
* Gets the variables which can be used as a placeholder in the filename.
*
* @param Mage_Core_Model_Abstract $model the model instance
*
* @return array with the variables which can be use as placeholders in the filename
*/
public function getModelVars($model)
{
if (!$model instanceof Mage_Sales_Model_Order) {
switch ($model) {
case $model instanceof Mage_Sales_Model_Order_Invoice:
$specificVars = array('{{invoice_id}}' => $model->getIncrementId());
break;
case $model instanceof Mage_Sales_Model_Order_Shipment:
$specificVars = array('{{shipment_id}}' => $model->getIncrementId());
break;
case $model instanceof Mage_Sales_Model_Order_Creditmemo:
$specificVars = array('{{creditmemo_id}}' => $model->getIncrementId());
}
$order = $model->getOrder();
$commonVars = array('{{order_id}}' => $order->getIncrementId(), '{{customer_id}}' => $order->getCustomerId(), '{{customer_name}}' => $order->getCustomerName(), '{{customer_firstname}}' => $order->getCustomerFirstname(), '{{customer_lastname}}' => $order->getCustomerLastname());
return array_merge($specificVars, $commonVars);
} else {
return array('{{order_id}}' => $model->getIncrementId(), '{{customer_id}}' => $model->getCustomerId(), '{{customer_name}}' => $model->getCustomerName(), '{{customer_firstname}}' => $model->getCustomerFirstname(), '{{customer_lastname}}' => $model->getCustomerLastname());
}
}