শপিং কার্ট প্রাইস বিধি কুপনের সাথে বিশিষ্টতা যুক্ত করুন


10

ম্যাজেন্টো-তে শপিং কার্টের মূল্য বিধিটিতে কোনও বৈশিষ্ট্য যুক্ত করার কোনও উপায় আছে কি? আমাকে প্রতিটি শপিং কার্টের মূল্য নিয়মের জন্য "বৈশিষ্ট্যযুক্ত" নামক একটি ক্ষেত্র যুক্ত করতে হবে এবং তার পরে, এই বৈশিষ্ট্য দ্বারা নিয়মগুলি ফিল্টার করতে সক্ষম হব।


1
যদি এটি বিক্রয়ের নিয়ম হয় তবে টোবিয়াস ভোগ নতুন ক্ষেত্র যুক্ত করার বিষয়ে দুর্দান্ত উপস্থাপনা করেছিলেন। এটি সবই জার্মান ভাষায় যদিও ওয়েবগুয়েস.ডি / প্রেসি / ওয়ার্নকর্পপ্রেসরিগেলন/# যখন আমার কিছুটা সময় আছে আমি এটিকে এখানে একটি উত্তরে অনুবাদ করব
ডেভিড ম্যানার্স

2
ড্যাঙ্কে ডেভিড ম্যানার্স, ইচ্ছুক স্প্রচে ডয়চে!
mbalparda

ওহ হ্যাঁ আমি এটি ভুলে গেছি ... আপনি যদি একটি উত্তর পান তবে আপনার সমাধানটি উত্তর হিসাবে নির্দ্বিধায় অনুভব করুন :)
ডেভিড ম্যানার্স

উত্তর:


8

আমি মিউজিক লিফটসমে উত্তর ব্যবহার করে শেষ করেছি । এখানে বিক্রয়-টেবিল আপডেট করার জন্য এটি একটি ইনস্টলারের সাথে সম্পূর্ণ কোড।

মডিউল এখানে উপলব্ধ

অ্যাপ্লিকেশন / কোড / স্থানীয় / মেগাবাইট / গুণাবলী / ব্লক / Adminhtml / সম্পাদনা / ট্যাব / Main.php

<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition License
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magentocommerce.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_Adminhtml
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://www.magentocommerce.com/license/enterprise-edition
 */

/**
 * Shopping Cart Price Rule General Information Tab
 *
 * @category Mage
 * @package Mage_Adminhtml
 * @author Magento Core Team <core@magentocommerce.com>
 */
class MB_Attributes_Block_Adminhtml_Edit_Tab_Main
    extends Mage_Adminhtml_Block_Widget_Form
    implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
    /**
     * Prepare content for tab
     *
     * @return string
     */
    public function getTabLabel()
    {
        return Mage::helper('salesrule')->__('Rule Information');
    }

    /**
     * Prepare title for tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return Mage::helper('salesrule')->__('Rule Information');
    }

    /**
     * Returns status flag about this tab can be showed or not
     *
     * @return true
     */
    public function canShowTab()
    {
        return true;
    }

    /**
     * Returns status flag about this tab hidden or not
     *
     * @return true
     */
    public function isHidden()
    {
        return false;
    }

    protected function _prepareForm()
    {
        $model = Mage::registry('current_promo_quote_rule');

        $form = new Varien_Data_Form();
        $form->setHtmlIdPrefix('rule_');

        $fieldset = $form->addFieldset('base_fieldset',
            array('legend' => Mage::helper('salesrule')->__('General Information'))
        );

        if ($model->getId()) {
            $fieldset->addField('rule_id', 'hidden', array(
                'name' => 'rule_id',
            ));
        }

        $fieldset->addField('product_ids', 'hidden', array(
            'name' => 'product_ids',
        ));

        $fieldset->addField('name', 'text', array(
            'name' => 'name',
            'label' => Mage::helper('salesrule')->__('Rule Name'),
            'title' => Mage::helper('salesrule')->__('Rule Name'),
            'required' => true,
        ));

        $fieldset->addField('description', 'textarea', array(
            'name' => 'description',
            'label' => Mage::helper('salesrule')->__('Description'),
            'title' => Mage::helper('salesrule')->__('Description'),
            'style' => 'height: 100px;',
        ));

        $fieldset->addField('is_active', 'select', array(
            'label'     => Mage::helper('salesrule')->__('Status'),
            'title'     => Mage::helper('salesrule')->__('Status'),
            'name'      => 'is_active',
            'required' => true,
            'options'    => array(
                '1' => Mage::helper('salesrule')->__('Active'),
                '0' => Mage::helper('salesrule')->__('Inactive'),
            ),
        ));

        if (!$model->getId()) {
            $model->setData('is_active', '1');
        }

        if (Mage::app()->isSingleStoreMode()) {
            $websiteId = Mage::app()->getStore(true)->getWebsiteId();
            $fieldset->addField('website_ids', 'hidden', array(
                'name'     => 'website_ids[]',
                'value'    => $websiteId
            ));
            $model->setWebsiteIds($websiteId);
        } else {
            $field = $fieldset->addField('website_ids', 'multiselect', array(
                'name'     => 'website_ids[]',
                'label'     => Mage::helper('salesrule')->__('Websites'),
                'title'     => Mage::helper('salesrule')->__('Websites'),
                'required' => true,
                'values'   => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm()
            ));
            $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
            $field->setRenderer($renderer);
        }

        $customerGroups = Mage::getResourceModel('customer/group_collection')->load()->toOptionArray();
        $found = false;

        foreach ($customerGroups as $group) {
            if ($group['value']==0) {
                $found = true;
            }
        }
        if (!$found) {
            array_unshift($customerGroups, array(
                'value' => 0,
                'label' => Mage::helper('salesrule')->__('NOT LOGGED IN'))
            );
        }

        $fieldset->addField('customer_group_ids', 'multiselect', array(
            'name'      => 'customer_group_ids[]',
            'label'     => Mage::helper('salesrule')->__('Customer Groups'),
            'title'     => Mage::helper('salesrule')->__('Customer Groups'),
            'required'  => true,
            'values'    => Mage::getResourceModel('customer/group_collection')->toOptionArray(),
        ));

        $couponTypeFiled = $fieldset->addField('coupon_type', 'select', array(
            'name'       => 'coupon_type',
            'label'      => Mage::helper('salesrule')->__('Coupon'),
            'required'   => true,
            'options'    => Mage::getModel('salesrule/rule')->getCouponTypes(),
        ));

        $couponCodeFiled = $fieldset->addField('coupon_code', 'text', array(
            'name' => 'coupon_code',
            'label' => Mage::helper('salesrule')->__('Coupon Code'),
            'required' => true,
        ));

        $autoGenerationCheckbox = $fieldset->addField('use_auto_generation', 'checkbox', array(
            'name'  => 'use_auto_generation',
            'label' => Mage::helper('salesrule')->__('Use Auto Generation'),
            'note'  => Mage::helper('salesrule')->__('If you select and save the rule you will be able to generate multiple coupon codes.'),
            'onclick' => 'handleCouponsTabContentActivity()',
            'checked' => (int)$model->getUseAutoGeneration() > 0 ? 'checked' : ''
        ));

        $autoGenerationCheckbox->setRenderer(
            $this->getLayout()->createBlock('adminhtml/promo_quote_edit_tab_main_renderer_checkbox')
        );

        $usesPerCouponFiled = $fieldset->addField('uses_per_coupon', 'text', array(
            'name' => 'uses_per_coupon',
            'label' => Mage::helper('salesrule')->__('Uses per Coupon'),
        ));

        $fieldset->addField('uses_per_customer', 'text', array(
            'name' => 'uses_per_customer',
            'label' => Mage::helper('salesrule')->__('Uses per Customer'),
        ));

        $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
        $fieldset->addField('from_date', 'date', array(
            'name'   => 'from_date',
            'label'  => Mage::helper('salesrule')->__('From Date'),
            'title'  => Mage::helper('salesrule')->__('From Date'),
            'image'  => $this->getSkinUrl('images/grid-cal.gif'),
            'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
            'format'       => $dateFormatIso
        ));
        $fieldset->addField('to_date', 'date', array(
            'name'   => 'to_date',
            'label'  => Mage::helper('salesrule')->__('To Date'),
            'title'  => Mage::helper('salesrule')->__('To Date'),
            'image'  => $this->getSkinUrl('images/grid-cal.gif'),
            'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
            'format'       => $dateFormatIso
        ));

        $fieldset->addField('sort_order', 'text', array(
            'name' => 'sort_order',
            'label' => Mage::helper('salesrule')->__('Priority'),
        ));


        $fieldset->addField('featured', 'select', array(
            'label'     => Mage::helper('salesrule')->__('Featured'),
            'title'     => Mage::helper('salesrule')->__('Featured'),
            'name'      => 'featured',
            'options'   => array(
                '1' => Mage::helper('salesrule')->__('Yes'),
                '0' => Mage::helper('salesrule')->__('No'),
            ),
        ));


        $fieldset->addField('is_rss', 'select', array(
            'label'     => Mage::helper('salesrule')->__('Public In RSS Feed'),
            'title'     => Mage::helper('salesrule')->__('Public In RSS Feed'),
            'name'      => 'is_rss',
            'options'   => array(
                '1' => Mage::helper('salesrule')->__('Yes'),
                '0' => Mage::helper('salesrule')->__('No'),
            ),
        ));

        if(!$model->getId()){
            //set the default value for is_rss feed to yes for new promotion
            $model->setIsRss(1);
        }

        $form->setValues($model->getData());

        $autoGenerationCheckbox->setValue(1);

        if ($model->isReadonly()) {
            foreach ($fieldset->getElements() as $element) {
                $element->setReadonly(true, true);
            }
        }

        //$form->setUseContainer(true);

        $this->setForm($form);

        // field dependencies
        $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
            ->addFieldMap($couponTypeFiled->getHtmlId(), $couponTypeFiled->getName())
            ->addFieldMap($couponCodeFiled->getHtmlId(), $couponCodeFiled->getName())
            ->addFieldMap($autoGenerationCheckbox->getHtmlId(), $autoGenerationCheckbox->getName())
            ->addFieldMap($usesPerCouponFiled->getHtmlId(), $usesPerCouponFiled->getName())
            ->addFieldDependence(
                $couponCodeFiled->getName(),
                $couponTypeFiled->getName(),
                Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
            ->addFieldDependence(
                $autoGenerationCheckbox->getName(),
                $couponTypeFiled->getName(),
                Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
            ->addFieldDependence(
                $usesPerCouponFiled->getName(),
                $couponTypeFiled->getName(),
                Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
        );

        Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', array('form' => $form));

        return parent::_prepareForm();
    }
}

অ্যাপ্লিকেশন / কোড / স্থানীয় / মেগাবাইট / গুণাবলী জন্য / etc / config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <MB_Attributes>
            <version>0.1.1</version>
        </MB_Attributes>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <promo_quote_edit_tab_main>MB_Attributes_Block_Adminhtml_Edit_Tab_Main</promo_quote_edit_tab_main>
                </rewrite>
            </adminhtml>
        </blocks>
        <resources> 
            <mbattributes_setup>
                <setup>
                    <module>MB_Attributes</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </mbattributes_setup>
        </resources>
    </global>
</config>

অ্যাপ্লিকেশন / কোড / স্থানীয় / মেগাবাইট / আরোপ / SQL / mbattributes_setup / mysql4-ইনস্টল-0.1.1.php

<?php

$installer = $this;
$installer->startSetup();

$installer->getConnection()
    ->addColumn($installer->getTable('salesrule'),
        'featured',
        array(
            'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
            'length' => 6,
            'nullable' => false,
            'default' => 0,
            'comment' => 'Is featured'
        )
    );

$installer->endSetup();

অ্যাপ্লিকেশন / ইত্যাদি / মডিউল / MB_Attributes.xml

<?xml version="1.0"?>
<config>
    <modules>
        <MB_Attributes>
            <active>true</active>
            <codePool>local</codePool>
        </MB_Attributes>
    </modules>
</config>

অতিরিক্ত তথ্য: আমি যখন এমবি_এট্রিবিউটস_ব্লক_এডমিনহটিটিএমএল_এডিট_ট্যাব_মেন থেকে কিছু পদ্ধতি মুছে ফেলার চেষ্টা করেছি

[Mon May 18 15:26:34.805303 2015] [:error] [pid 19354] [client 127.0.0.1:37117] PHP Fatal error:  Class MB_Attributes_Block_Adminhtml_Edit_Tab_Main contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (Mage_Adminhtml_Block_Widget_Tab_Interface::getTabLabel, Mage_Adminhtml_Block_Widget_Tab_Interface::getTabTitle, Mage_Adminhtml_Block_Widget_Tab_Interface::canShowTab, ...) in /var/www/wa/app/code/local/MB/Attributes/Block/Adminhtml/Edit/Tab/Main.php on line 252, referer: http://wa-dev.com/index.php/admin/promo_quote/index/key/ee3695e7425bea8ad8bef471e3262e74ee161ff8c10f8132cea80280496abe15/

6
  1. featuredটেবিলটিতে একটি নতুন কলাম ইনস্টল করুন salesrule

  2. লেখা Mage_Adminhtml_Block_Promo*শ্রেণীর এই নতুন feauture জন্য প্রশাসক ইন্টারফেস আপডেট করতে।

আপনি এটি করার পরে, আপনি আপনার নতুন কলাম দ্বারা ফিল্টার করতে পারেন।


আমি এই কাজটি শেষ করেছি, এক সেকেন্ডে অসুস্থতা আপলোড করেছি।
mbalparda

-3

প্রশাসকটিতে যান Catalog > Attributes > Manage Attributes, তারপরে আপনার বৈশিষ্ট্যটি খুলুন। অধীনে Frontend Properties, সেট Use for Promo Rule Conditionsকরতে Yes। এটি আপনাকে শপিং কার্টের মূল্য বিধিগুলিতে আপনার অ্যাট্রিবিউটটি ব্যবহার করার অনুমতি দেবে।


প্রোমো রুল কন্ডিশনের ব্যবহারের অর্থ পণ্যটির গুণাবলী প্রচারের ক্ষেত্রে ব্যবহার করা যেতে পারে প্রচারের ক্ষেত্রে ফিল্টারযোগ্য বৈশিষ্ট্য হিসাবে নয়।
mbalparda

আপনার প্রশ্নটি কিছুটা অস্পষ্ট, সুতরাং আমি বিক্রয় মূল্যে কোনও কলাম যুক্ত করার পরিবর্তে কোনও বিক্রয় বৈশিষ্ট্যকে ব্যবহারযোগ্য করে তোলার আরও সাধারণ ক্ষেত্রে ধরে নিয়েছি itself
Agop
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.