gl636474 / NaturesCupboard2

0 stars 0 forks source link

Only show specified payment method(s) for specified customer groups #29

Closed gl636474 closed 4 years ago

gl636474 commented 4 years ago

Need to ask Jen if she wants this. For example only show bank transfer option for a group called "friends" or similar.

It appears this cannot be done in Magento out of the box. It requires an Observer to be coded. See https://magento.stackexchange.com/questions/33047/displaying-certain-payment-methods-for-customer-groups

gl636474 commented 4 years ago

Need to have a multi select in system.xml where can select payment methods for each customer type.

gl636474 commented 4 years ago

https://www.integer-net.com/how-to-create-tables-in-magento-system-configuration/

gl636474 commented 4 years ago

Possibly a multi select with separate sections per customer type and able to select each of the payment types for each customer type:

http://excellencemagentoblog.com/blog/2011/11/02/magento-admin-form-field/

gl636474 commented 4 years ago

Creating new section/groups in system config and adding to existing sections/groups:

http://excellencemagentoblog.com/blog/2011/09/22/magento-part8-series-systemxml/

gl636474 commented 4 years ago

Also for tables in config area: https://raivis.com/how-to-add-custom-table-like-configuration-field-in-magento-admin/

Door not say how ti specify what type of field to add - possibly further args to addColumn() which assumes a text field if not specified.

gl636474 commented 4 years ago

To render a customer group select in a dynamic table: Mage_CatalogInventory_Block_Adminhtml_Form_Field_Minsaleqty

Although we probably just want yes/no selects instead - one in each customer group column for each payment method row, or maybe just one column with a multi select - but what sort of nested array would that be in the database?

gl636474 commented 4 years ago

Creating a SELECT block : Mage_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup

gl636474 commented 4 years ago

When creating an array data in a system config table field, Magento appears to create the row arrays with sequential unique ids instead of just 0,1,2,etc. This ID is the time as returned by PHP time() method and prefixed with underscore and suffixed with nnn_nnn. Otherwise the array is just serialised using PHP serialize() method and saved using Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); Should probably update Data helper to add a save method (which replaces int keys with the above if necessary so that it can be called by and upgrade script to set up payment method controls.