本文整理汇总了PHP中Mage::getresourceModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getresourceModel方法的具体用法?PHP Mage::getresourceModel怎么用?PHP Mage::getresourceModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getresourceModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAction
public function saveAction()
{
if ($this->getRequest()->getPost()) {
try {
$postData = $this->getRequest()->getPost();
$cartexModel = Mage::getModel('cartex/cart_entity');
$cartexId = Mage::getresourceModel('cartex/cart_entity')->fetchbyEntityId($this->getRequest()->getParam('id'));
if ($cartexId) {
$cartexModel->setId($cartexId);
}
$cartexModel->setPromoName($postData['promo_name'])->setDescription($postData['description'])->setPromoCode($postData['promo_code'])->setPromoType($postData['promo_type'])->setIsActive($postData['is_active'])->setStoreId($postData['store_id'])->setEntityId($this->getRequest()->getParam('id'))->setEntityTypeId(4)->save();
// if(isset($postData['rule_id']))
// {
// $cartexModel->setRuleId($postData['rule_id'])->save();
// }
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully saved'));
Mage::getSingleton('adminhtml/session')->setCartexData(false);
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setCartexData($this->getRequest()->getPost());
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
$this->_redirect('*/*/');
}
示例2: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getresourceModel('eav/entity_attribute_set_collection');
$collection->addFieldToFilter('attribute_set_name', array('neq' => 'Default'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例3: _getSelectedProducts
protected function _getSelectedProducts()
{
$productEntityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId();
$cartexId = Mage::app()->getFrontController()->getRequest()->get('id');
$products = Mage::getresourceModel('cartex/cart_groups')->fetchbyAttributeId($cartexId, $productEntityTypeId);
return $products;
}
示例4: getIdxCollection
public function getIdxCollection()
{
$itemCollection = Mage::getresourceModel('cartex/cart_idx')->fetchbyQuoteId($this->_quoteId);
foreach ($itemCollection as $item) {
$this->_itemIdxCollection[] = $item['item_id'];
}
return $this->_itemIdxCollection;
}
示例5: setPromoId
protected function setPromoId()
{
$this->_promoId = Mage::getresourceModel('cartex/cart_products')->getPromoIdbyProduct($this->getProduct()->getId());
if ($this->_promoId != 0) {
$this->_view = true;
}
return $this->_promoId;
}
示例6: processRule
public function processRule($promo)
{
$this->setCurrentPromoCollection($promo);
$groupCollection = Mage::getresourceModel('cartex/cart_groups_collection')->addFilter('wdc_attribute_id', $promo->getId())->addFilter('entity_type_id', $this->_entityTypeId);
if ($groupCollection) {
foreach ($groupCollection as $group) {
echo '<br>help!';
}
}
}
示例7: processRule
public function processRule($promo)
{
$this->setCurrentPromoCollection($promo);
//$this->_promoGroupId = $promo->getId();
//$this->_entityTypeId = $promo->getEntityTypeId();
$valueCollection = Mage::getresourceModel('cartex/cart_value_collection')->addFilter('wdc_attribute_id', $promo->getId());
if ($valueCollection) {
foreach ($valueCollection as $checkVal) {
$this->validateExpressions($checkVal);
}
}
}
示例8: getAssignedProducts
protected function getAssignedProducts()
{
$products = array();
$productEntityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId();
$cartexId = Mage::app()->getFrontController()->getRequest()->get('id');
$collection = Mage::getresourceModel('cartex/cart_groups_collection')->addFilter('entity_type_id', $productEntityTypeId)->addFilter('wdc_attribute_id', $cartexId);
foreach ($collection as $item) {
////Mage::helper('errorlog')->insert('getAssignedProducts()-collection', $item->getEntityId());
$products[] = $item->getEntityId();
////Mage::helper('errorlog')->insert('serializer', $item->getEntityId());
}
return $products;
}
示例9: addAction
public function addAction()
{
$itemId = $this->getRequest()->getParam('item_id');
if (isset($itemId) && !empty($itemId)) {
$row = Mage::getresourceModel('cartex/cart_idx')->fetchRowbyItemId($itemId);
$idx = Mage::getModel('cartex/cart_idx')->load($row['item_idx_id']);
$idx->setIsCurrent(1)->save();
$cart = Mage::getModel('checkout/cart');
$cart->addProduct((int) $row['product_id'], $row['qty']);
$cart->save();
$this->_redirect('checkout/cart/');
}
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->_objectId = 'id';
$this->_blockGroup = 'cartex';
$this->_controller = 'adminhtml_entity';
$this->_updateButton('save', 'label', Mage::helper('cartex')->__('Save Cart Promo'));
$this->_updateButton('delete', 'label', Mage::helper('cartex')->__('Delete Cart Promo'));
if ($this->getRequest()->getParam($this->_objectId)) {
$model = Mage::getModel('cartex/cart_entity')->load($this->getRequest()->getParam($this->_objectId));
Mage::register('cartex_data', $model);
$valueId = Mage::getresourceModel('cartex/cart_value')->fetchbyAttributeId($model->getId());
$valueModel = Mage::getModel('cartex/cart_value')->load($valueId);
Mage::register('cartex_valuedata', $valueModel);
}
}
示例11: getPromoProduct
protected function getPromoProduct()
{
$itemCollection = Mage::getresourceModel('cartex/cart_item_collection')->addFilter('wdc_attribute_id', $this->_promoId);
foreach ($itemCollection as $item) {
$this->_promoproductId = $item->getEntityId();
break;
}
if ($this->_promoproductId != 0) {
$product = Mage::getModel('catalog/product')->load($this->_promoproductId);
if ($product->getStockItem()->getIsInStock() == 1) {
return $product->getName();
}
} else {
return $this->getProduct()->getId();
}
}
示例12: getPromoProduct
public function getPromoProduct()
{
$_product = null;
foreach ($this->getActivePromoGroups() as $promo) {
if (in_array($promo->getPromoType(), $this->getQualifyIds())) {
if ($promo->getExceptionTypeId() == 0) {
foreach ($this->_getGroups($promo->getCartexId(), Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId()) as $productId) {
if ($productId->getEntityId() == $this->getProduct()->getId()) {
$item = Mage::getresourceModel('cartex/cart_item')->fetchbyAttributeId($promo->getCartexId());
foreach ($item as $promoProduct) {
$_product = Mage::getModel('catalog/product')->load($promoProduct);
break;
}
}
}
}
}
}
return $_product;
}
示例13: addLineCartItem
public function addLineCartItem($productId)
{
$this->_quoteId = Mage::getSingleton('checkout/session')->getQuoteId();
$product = $this->_getProduct($productId);
$this->_productId = $productId;
$sellPrice = $product->getFinalPrice() - $this->_discount_amount;
$product->setPrice($sellPrice);
$product->setFinalPrice($sellPrice);
$data = array('quote_id' => $this->_quoteId, 'created_at' => Mage::getModel('core/date')->date('Y-m-d'), 'updated_at' => Mage::getModel('core/date')->date('Y-m-d'), 'product_id' => $productId, 'parent_item_id' => NULL, 'is_virtual' => '0', 'sku' => $product->getSku(), 'name' => $product->getName(), 'applied_rule_ids' => $this->setCurrentRuleId(), 'additional_data' => NULL, 'free_shipping' => '0', 'is_qty_decimal' => '0', 'no_discount' => '1', 'weight' => $product->getWeight(), 'qty' => $this->_promo_add_cnt, 'price' => $sellPrice, 'base_price' => $sellPrice, 'custom_price' => $sellPrice, 'discount_percent' => '0.0000', 'discount_amount' => $this->_discount_amount, 'base_discount_amount' => $this->_discount_amount, 'tax_percent' => '0.0000', 'tax_amount' => '0.0000', 'base_tax_amount' => '0.0000', 'row_total' => $sellPrice * $this->_promo_add_cnt, 'base_row_total' => $sellPrice * $this->_promo_add_cnt, 'row_total_with_discount' => $sellPrice * $this->_promo_add_cnt, 'row_weight' => $product->getWeight() * $this->_promo_add_cnt, 'product_type' => $product->getTypeId(), 'base_tax_before_discount' => '0.0000', 'tax_before_discount' => '0.0000', 'original_custom_price' => $sellPrice, 'gift_message_id' => NULL, 'weee_tax_applied' => 'a:0:{}', 'weee_tax_applied_amount' => '0.0000', 'weee_tax_applied_row_amount' => '0.0000', 'base_weee_tax_applied_amount' => '0.0000', 'base_weee_tax_applied_row_amount' => '0.0000', 'weee_tax_disposition' => '0.0000', 'weee_tax_row_disposition' => '0.0000', 'base_weee_tax_disposition' => '0.0000', 'base_weee_tax_row_disposition' => '0.0000');
if ($this->checkVersion() == 2) {
$v14 = array('store_id' => $this->_getStore());
$data = array_merge($data, $v14);
}
Mage::getresourceModel('cartex/cart_idx')->insertCartItem($data, $this->_promoGroupId);
}
示例14: _getGroups
protected function _getGroups($promoId, $entityTypeId)
{
return Mage::getresourceModel('cartex/cart_groups_collection')->addFilter('entity_type_id', $entityTypeId)->addFilter('wdc_attribute_id', $promoId);
}
示例15: relatedAction
public function relatedAction()
{
$gridBlock = $this->getLayout()->createBlock('cartex/adminhtml_entity_edit_tab_related')->setGridUrl($this->getUrl('*/*/gridOnly', array('_current' => true, 'gridOnlyBlock' => 'related')));
$cartexId = $this->getRequest()->getParam('id');
$productEntityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId();
$collection = Mage::getresourceModel('cartex/cart_groups_collection')->addFilter('entity_type_id', $productEntityTypeId)->addFilter('wdc_attribute_id', $cartexId);
$productsArray = array();
foreach ($collection as $product) {
$productsArray[] = $product->getEntityId();
}
$serializerBlock = $this->_createSerializerBlock('links[related]', $gridBlock, $productsArray);
$this->_outputBlocks($gridBlock, $serializerBlock);
}