Magento product availability in defined PIN codes only? - php

I have a Magento based site and Products are limited to Set of Pin codes. These PIN differ from product to product. What I need is to get an option to input set of PIN Codes, while defining a product. And on every product page there must be a Text field to check whether the product is available for the PIN Code, which is entered by the visitor.

HI For this first of all
1 create a new product attribute with multi-select type
2 assign all pin codes in there values under attribute options
3 assign that attribute to the desired attribute set
4 than for assigning attributes you need to go to product section and assign a desired zip options for that particular product from the multi-select attribute
5 on product page you need to problematically get all the selected values of that attribute
6 create a array of that values
7 create a simple form and when user post some value in that form , match that value in the array you defined above.
8 if the value finds in array than show the cart button and if not do what you want.
i hope this will give you a very fair idea. Let me know if i can do any other thing for you.

Related

Advanced Custom Fields in Wordpress - Show code & text if radio or checkbox selected or don't

Looking for help on an ACF repeater for 2 optional pre-populated fields.
Creating a menu for a client that looks like this for a menu:
[an example of 1 menu item line with all fields to visualize it]: (https://ibb.co/t2rq49K)
Repeater has 5 sub_fields as you can see in my PHP:
PHP Code but you'll see in my PHP i haven't applied logic to the * or the gfm as i'd like that to be optional and pre-populated in the acf settings so if the user selects either one (keep them separate fields) it would add it to the correct place in the code.
At this point, there are see 3 fields i've put in (menu item name, description and price) that work great, however there are two other OPTIONAL items that I would like to have default values for:
<sup>*</sup>
and
<u>gym</u>
user would check a box/or radio button to add in the backend when adding a new menu item. Some items would have the * AND gfm, some would have maybe just one of the 2 and some may not have either one.
Anyone have any help with this for the PHP code and what i need to add for the acf settings?

Magento, insert value in a custom attribute after save products

I've created a custom attribute for products in Magento, I want insert this value after the product is saved, because I must insert a code that read the field weight and calculate the price of spedition for that. I need that value because I must send that value in a module for eBay that takes all value in products when I launch it. I am a beginner in Magento. So do you have some code, info or other that can help me, how I can do that?
Hi you can use catalog_product_save_after event which trigger after product saves . you can listen this event and get all product data and you can set any attribute value from there.

Woocommerce Product Variations attributes

I have a Question regarding Product attributes.
Generally Products attributes display in a drop down, when you select attribute from the drop down it will show an add to cart button. This is the Woo-commerce default flow of attributes.
Now my question is that I don't like to display attributes in a select box. I would like to display as my layout.
For example, we have size attributes in Product and that will display in the select box, but I want to display in circle designs. I don't want to display as a drop down.
Yes you can do this. you can get all your product variations using
$product->get_available_variations() It'll return an array containing all your product variation data. When user selects an option woocommerce updating an input value with the selection. It's a hidden input in your source. You need to find that input field and update it's value. I normally use jquery for that.
Hope it'll help.
Thanks.

Prestashop 1.6: extra product_attribute field and display it at the product page depending on the choice of the attribute

I have a little question
I have already added an extra field to my product table and this is working very well.
What I want:
But now I want to add an extra field to the ps_product_attribute table and display it below the price depending on the attribute that is selected by the customer.
A little more info:
When you use the Prestashop combinations you can add a reference to every combination. When the customer changes the combination, the reference name is automatically changed (refreshed?) on the product page. So the displayed reference name is depending on the choice of combination the customer is making. This is working fine.
Now just like this I want to display my extra field from my ps_product_attribute table below the price. The extra field is containing a specific price unit that is depending on the attribute choice.
My problem:
I have already added the extra field to the database table (ps_product_attribute) but I do not know how I can display this on on the product page
and
how the value is refreshed (or changed) when the customer selects another combination.
I hope you understand my question. Any help would be grateful.

Save selectlist value (taxonomy) in wp and selected item

In my admin for part i have additional fields (like price or brand - which is taxonomy). When i edit or create new part, i set up additional data.
and price saving is without any problem, but saving value from select list is something strange - it didn't save:
wp_set_object_terms($post_id, $_POST['part_brand'], 'brands', true);
according to wp doc: this function update value from taxonomy select. But for me it didn't work.
All code you could see here:
http://pastebin.com/N4gZL3uN
how to save value from select list (taxonomy) in wp?
i see that it didn't display selected value, why?

Categories