I have a product where it as multiple options for the user to select. say its a food item and it has different flavours and size packs.So i need to have an option in the UI for the users to select the option they want and that product need to be added to the basket with the user provided options.My question is how can i create these options in the backend and show that options in the UI.I saw a model named options in the admin dashboard.How can i make use of it.
Related
I am using Django to build data models including a model Company. Some of the fields belonging to this model are limited to set choices using the choices='' argument. Some of these fields have a large number of choices, for example a country CharField which lists all countries. Finding the right value among the long list can be tedious so I want to be able to search across the given choice values. This is easy to do for ForeignKey/ManytoMany fields using autocomplete_fields = [] as seen in the attached screenshot (from a different model) but can't seem to find a method for implementing this with a normal CharField with lots of choices. This seems like something that should be built into the Django for the admin panel but I can't find anything within the docs. Please how can I implement a search/filter dropdown for any given (non FK/m2m) fields? Thanks in advance. If there's anymore information I can provide let me know and I will.
country = models.CharField(max_length=128, choices=COUNTRY_CHOICES, null=True)
Model code added. This COUNTRY_CHOICES array is what I would like to be able to select from in a searchable dropdown list.
I am currently using Shopizer as a sort of headless CMS, leveraging its out of the box admin pages and REST API for the content. There is a page for editing products in the admin system but I would like to add and/or remove specific fields. Making changes to the base code seems to be the most obvious solution but it is taking me a significant amount of time to implement it successfully.
Is there some sort of a config file or an initialization process to customize the fields for creating categories and products using Shopizer's admin page? What is the best practice for this scenario if the former approach is not possible?
If you need to add fields the easiest way is to add them in model objects
com.salesmanager.core.model.*
Example of an annotated field
#Column (name ="IP_ADDRESS")
private String ipAddress;
Once you restart your instance the new field will be available.
I am currently working in a sales tracking project - where I am constantly getting into situation where I have to duplicate code about listing, showing or editing models.
I have 3 models, Lead, Customer, and Sales Activity. with 1:1 relations between Lead and Customer and 1:M relation between Lead and Sales Activity.
What I want is that when I SHOW a Lead, I should be able to reuse the show function of customer admin class, and I don't have to redo it in the show function of the Lead admin class.
Similarly, I want to be able add the LIST and CREATE function of the Sales Activity class into the Lead SHOW function without having to recode that which is already present. I could use render(controller()) in a custom template - but that includes the base template as well of the target controller, and it just messes the whole layout
I appreciate any input on the matter. thanks for your time.
Basic answer would be Admin class inheritance.
Another one would be to make a trait with your configureShowFields and use this trait in all of your admin classes.
If you are open to trying out a new bundle you can check : https://github.com/blast-project/CoreBundle
This bundle allows configuration of you admins in Yaml
And one of the features would suit your use case it would look like:
all:
Sonata\AdminBundle\Show\ShowMapper:
add:
name:
type: text
address:
type: textarea
...
It will let you configure your mappers for all your admins
I have prestashop website and during the checkout process when choosing the carrier I added a dropdown which contains additional information about shipping when you choose the certain carrier.
More specific: one carrier provide "self-service parcel terminals" service, where customer have to choose the final shipping destination(address) from where he'll pick up the product. The dropdown list contains about 30 choices.
I added dropdown with carrier information as a module and hooked it in hookDisplayBeforeCarrier hook.
How should I save this data into database and then display it in backoffice in orders section?
To fulfills your requirements, you need to use following hooks of PrestaShop.
processCarrier - To save the selection in a cookie or something temporarily
hookNewOrder - To fetch and save the selection into database on order place
displayBackOfficeHeader - To display the selection in back office order details.
I need to create a custom registration form in joomla with the possibility to select a group.
Example 1:
User A selects the group "Group1" and displays the registration form with the fields "First name,"
The user selects the B group "Group2" and displays the registration form with the fields "Name, Last Name, City, away,"
Example 2 with Photos:
There is a component in joomla that can do this?
Thank you so much for the help.
You can achieve this with ChronoForms (especially v5) using DIV IDs or similar for the fields you want to show or hide together with a few lines of JavaScript.
The choice can be controlled via check box(es) or a drop down menu etc.
There are some examples of this in the ChronoEngine forums e.g.:
http://www.chronoengine.com/forums/posts/f5/t95421/hide-unhide-div-container-easy.html?hilit=show+hide+dropdown+javascript
You can find more examples by searching the forums for "hide unhide javascript"
Two form components in Joomla with extensive options and database integration are ChronoForms and RSForms Pro which I recommend.
http://extensions.joomla.org/extensions/contacts-and-feedback/forms/4964
[http://extensions.joomla.org/extensions/contacts-and-feedback/forms/15082