本文整理汇总了PHP中Mage_Core_Model_Abstract::getProductId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getProductId方法的具体用法?PHP Mage_Core_Model_Abstract::getProductId怎么用?PHP Mage_Core_Model_Abstract::getProductId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getProductId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _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);
}
示例4: _afterSave
/**
* Assign page to store views
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Cms_Model_Resource_Page
*/
protected function _afterSave(Mage_Core_Model_Abstract $object)
{
if ($object->hasProductId()) {
$oldProducts = $this->getProductIds($object->getId());
$newProducts = (array) $object->getProductId();
$table = $this->getTable('cmsproducts/cms_page_product');
$insert = array_diff($newProducts, $oldProducts);
$delete = array_diff($oldProducts, $newProducts);
if ($delete) {
$where = array('page_id = ?' => (int) $object->getId(), 'product_id IN (?)' => $delete);
$this->_getWriteAdapter()->delete($table, $where);
}
if ($insert) {
$data = array();
foreach ($insert as $productId) {
$data[] = array('page_id' => (int) $object->getId(), 'product_id' => (int) $productId);
}
$this->_getWriteAdapter()->insertMultiple($table, $data);
}
}
return parent::_afterSave($object);
}
示例5: getAllParentSkuFromItem
/**
* Get current and parent product SKU from the quote item.
*
* @param Mage_Core_Model_Abstract
* @return array
*/
protected function getAllParentSkuFromItem(Mage_Core_Model_Abstract $item)
{
$skus = [$item->getSku()];
/** @var Mage_Sales_Model_Quote_Item */
$parentItem = $item->getParentItem();
if ($parentItem) {
if ($item->getProductId() !== $parentItem->getProductId()) {
$skus[] = $parentItem->getSku();
}
}
return $skus;
}