bootstrap how to add/remove category just like opencart? - php

Recently, I working on a PHP project that comes with product and product category. Each product can assign to multiple categories.
Product name, quantity all these are quite easy to handle as they are input text box. But for category, its a bit complicated. So i use checkboxes to handle category selection. It works fine for inserting mysql as i simply use foreach loop to check which checkbox has clicked. To update/del by using array_diff to check the new selected checkbox or unselected.
Then I found out that opencart handle category in this way
1 input box for user to key in category name with auto suggestion, when clicking on the suggested name, it will be added. so to remove it, just click on the minus sign button. Its simply and straight forward.
So I am wondering is there a way to do something like that by using bootstrap design? OR is there some opensource for such function ?

Related

FacetWP + ACF = Exclude product if not manufactured anymore

For the last few days I have been wrapping my head around this but for the life of me, can't figure out a way to do this.
I have a WordPress website dedicated to different categories of products. I use Custom Post Type UI to create the product categories, ACF for custom fields for each product type and then FacetWP for the indexing and filtering part. Each category has a dedicated catalogue style page where I have certain filters from FacetWP for users to narrow down their search for a product that fits their requirements.
Everything is working well, however, my issue is that some products get discontinued and are being replaced by newer versions. Because of this, I have added a custom field for each category such as "wm_manufactured" (washing machines) that has a simple check box with "Yes". If the checkbox is ticked, then I want the product to be displayed in the catalogue.
Does anyone know how to skip products or remove them from indexing if a certain field is empty or maybe another way of doing this?
I need these product pages to still be available through a direct link because they are being ranked high on Google and I have a banner informing customers that this particular product has been discontinued and have a link to its replacement.
So I found the answer to my trouble and it was right in front of me.
When making a "Listing" template in FacetWP, there is a second tab called Query.
When I was testing the query filters, I was only putting the value that I set up on ACF, but the actual value that I had to add for the system to compare to was the exact figure from inside the database.
While ACF would have returned a "yes" for example, FacetWP was only seeing
a : 1 : { i : 0; s : 3 : "yes"; }
the value present in the database. So check the database for the exact value and don't just go based on what ACF will return.

Dynamically pass a Product ID as the main Product Field on a Gravity Form (Product Add On)

I've got a great form set up to allow the building of a complex product and then add it to the cart (using the GForms Product Add on). All lif this is perfect on the actual Woocommerce product page.
What I'd love to do is have this form embedded on a page and populate the Product ID dynamically, so that the form still picks up the product details and will add the new Item to the cart just as it does on a shop page. Having it on its own page (or on any page of the site) will allow us to offer a larger, focused experience to select all the options.
I've been looking into the code and the docs but I can't seem to make it work. The code references product_id everywhere, but the dynamic field option is name. So is this possible? Thanks!
If the data you are attempting to map is simple then the following snippet plus Gravity Forms default {embed_post} and {custom_field} merge tags can get you there:
https://gravitywiz.com/dynamic-products-via-post-meta/
If your data is more advanced (like mapping product attributes), check out Gravity Form Populate Anything:
https://gravitywiz.com/documentation/gravity-forms-populate-anything/

Sonata admin dropdown with ajax data results

I am working on a sonata admin panel using symfony 3.3. I have two entities Category and Chalets. They are associated many to many so that One category have many Chalets and Chalet can be associated to many Categories.
I want the functionality in my admin panel to show the Chalets based on Category choosen from dropdown and a button to replicate the same to add another category with Chalets and so on.
The picture below will give you the deep insights.
Picture of my current functionality
Right now all the Chalets added in the database are visible in the dropdown I want to show only the selected category Chalets to be shown. Alson, the button(Add more) will replicate the Category and Chalet to repeat the process.
Thanks!
What you need is sonata_type_collection field.
It will look a bit different out of the box, but capabilities is exactly what you want.
So, how it works:
sonata_type_collection field will include a table inside of your edit form. Every row in this table is another Category.
there is possibility to add "Add" and "Delete" buttons, so you could add and delete categories directly from this edit form.
second column in this embed table could be "Charlets" field, and it can be editable inline (select2 elements). So you can choose charlets for every category.
when you add Category - it's a "create" form, it has only Category dropdown. But when you edit a row inline - it's an "edit" form, it will has also "Charlets" multi select. And options for this multi select can be generated based on chosen Category.
So, all this will work without any custom templates/Ajax calls.
P S. If you still want to customize UI - easier to do it with JavaScript.

Show price layered navigation after selecting price filter

I would like to show price filter option after selecting price filter already. So, I would like to keep all price filters, even if price filter is already selected. Is this possible?
magento uses the layered navigation system where when u filter a category with something say price, all the other possible selection in the price disappears in that filter, so if you want to pick another price range, you have to go back to the previous page or deselect the filter.
I did this using php sessions and writing a custom functionality to filter.phtml. I set sessions with filter name which includes url and title, and wrote if session is set, then write it. So I literally manually created all links, when one filter is selected. Hope this will help someone..
This answer links to a popular Free module which accomplishes what you are after and has been updated to the latest version of CE;
How to make Magento not hide layered navigation filters?
Here is the link;
https://www.magentocommerce.com/magento-connect/multiple-select-in-layered-navigation-filters.html

Create a custom attribute and add it to category grid view Magento

On some of my products (not all) I need to add a drop down to select from a list of products (varying depending on product). What is the best way to implement this so it get be chosen next to "add to cart" on the category grid on front end?
I did this just before few days. You want to show dropdown of simple products for any configurable products in category page, right? Check below link it will explain you step-by-step on implementing it. Let me know if you have something different in mind.
http://www.catgento.com/adding-configurable-product-options-to-category-list-in-magento/

Categories