add a shop name along with the products in zen cart - shopping-cart

single zen cart for different shops.
I would like to know how can we add a shop name along with each product in zen cart (in the sql table)

You haven't said whether the shops share the same products, but usually in this setup they do. If so, then adding the store name to the database would not be what you want to do, as the store name you add there would also be displayed on the other shops.
Instead you would have to either ...
catch the data as it is pulled from the data base (this normally happens in the includes/modules/pages/PAGE_NAME/header_php.php file for the center box content or the includes/modules/sideboxes file for sideboxes such as new products, specials
... or ...
catch the data at the point of display in the relevant page template or sidebox template files.

Related

Multiplechoice widget with really big lsit

In my model Person can have more than one partner, so the ManyToMany Model is the only answer (this has to be ManyToMany for other reasons, so please don't think about changing it).
If I use default widget i got a list of all persons with selected one, two maybe three persons (which are partners of Person).
It would be ok, if the Person list is about 10-100 - and it works on test database. But my prod database has 10.000 persons or more, so the ModelMultipleChoice widget would be filled with 10.000 records, and finding the correct partner will last ages, and memory usage isn't trivial.
I need only to see names of partners with possibility to unset it from person, and some possibility to add new just typing name. The best solution is to show listbox with filtered names after typing three or four first letters, but any solution would be great.
With forms it would be easier, but I need it in admin, so I'd like to use django admin standards.

Opencart set Store preferences

In Opencart we have the following type of products.
Printed Books (hard copies) which will be shipped to customer.
For the same we have Digital Downloads.
We want an option set at the store level whether user wants to see Downloads or Printed Copies.
When the user chooses downloads option, it should display only downloadable products in all the categories.
When user chooses Printed Copies, it should display only printed products in each of the categories.
Any suggestions to achieve this functionality are welcome.
Thanks
"Any suggestions to achieve this functionality"
From my point of view (which may not be optimal) we need:
Permanent storage for the user preference [5 % done]
add a column to the table <DB_PREFIX>customer with a type of INT and a value of 0 if the user is interested in all products, 1 for digital downloads and so on..., if there is a possibility that you will add new preferences later, then it's better to store a serialized version of all the user preferences in a column of type TEXT
A way to retrieve user preference [25 % done]
you can just retrieve it from the database every time you need it, a better way is to keep it in the session at the same way the user data (like address, telephone)in the class User is kept
A way to change the user preference [40 % done]
some check box in the user settings page, it's also preferable (UX wise) that the user preference is shown in the header next to his name and can be edited directly from there
And finally, displaying products based on that preference [100 % done :D]
you will need to change some code in the controller of the category page, best seller module, latest products .... (any module that involves displaying products)
Simple, naive and ugly solution:you will notice that there is a code segment that copies products data to the view data, it looks like
$data['products'][] = array( in OC 2.X and $this->data['products'][] = array( for versions prior to OC 2, a simple if condition here will be enough, just check for the user preference and decide accordingly whether to copy the product to the view data or not
Better solution: filter products based on the user preference from the very beginning in the model functions, add an extra optional parameter to all model functions that retrieves products (don't forget those functions that retrieves products count) that indicates the user preference, check inside model functions if the parameter is set then do you work in the query

DB Structure for a shopping cart

I like to develop a shopping cart website with multiple products.
(ex.: mobile phone, furniture etc.,)
here mobile phone specification will cover
size of display
memory
operating system
camera etc.,
but for furniture - its specification is entirely different from above electronic product.
type of wood
color
weight
shape
glass or mat finish etc.,
My question is: how to handle a common database-table for product specification ?
each & every category of product & its spec will be differ - so how to have a common
table ProductSpecificationTable ?
I searched many site including google.. but cant able to get the perfect soultion.
Please help me to move to next step.
Ask yourself the question: How can I accomplish this kind of database? First of all you need products.. Every product has to be in some kind of category and every category has to have his own properties. So, you've to create a product table with unique id and every product needs a category id. At this moment it is time to link from your property table to your category table(by id) and to set the values you need a 'property_value' table.
**table:** **id**
product --> category id
property --> category_id
property_value --> property_id
I hope you will understand my explanation otherwise just ask :)
You can add 1 more table to accomplish that. Table that contains cat_id, product_id and the property. That is a many to many relationship. I believe this way you can accomplish thst.
You can achieve this with a single table within a database but that will complicate the CRUD operations over the table. So I will recommend you to create one database like ‘Inventory’ which can have multiple tables (one table for each of the Product Type).
First Table could be list of Product Types you have (mobile phones, accessories, furniture):
You can use this table to populate your list of items available. Here the column _table_name will contain the actual name of the Tables.
Then for each of the product you can have different tables with different number of columns:
Table for Product Type Mobile Phones:
Table for Product Type Furniture:
I hope this will help.

Can you create default product attributes

I am trying to create a store of products with WooCommerce and would like, if possible, to simplify the process of adding new products by having a default set of attributes.
For example, all of my products share certain attributes including: volts, watts, colour temperature etc. I have created these attributes and can select them when I add a new product but it would be really useful, for consistency and speed, if every time I added a product of a certain category the Add Product page automatically added a given set of attributes, rather than me having to add each attribute one by one for every product I add.
Does anyone know if this is possible?

Django admin store dynamic formset added with ajax

I'm currently implementing a solution using django admin, it allows users to define in the db a product, and then custom attributes and details, more details may be aggregated by a common attribute, this allows me to query with ajax a custom view that returns some JSON data to build automagically the form fields that I need directly in the same formset view (manipulating the DOM).
The current DB design follows this schema:
Catalog(name, description, photo)
Product(rel_catalog, name, base_price, photo, manufacturer_email)
ProductDetail(rel_product, rel_attribute, percentage_price, fixed_price)
ProductAttribute(rel_product, name, description)
As you may see I have a catalog, where there can be more products, a lot of details per product, aggregated by attributes. Then I simple show by default the Catalog, then the select with all available products for that catalog, then, choosing the right Product, I obtain the complete form (each row has a label with ProductAttribute.name and a select with related ProductDetail).
All works pretty dam good, but I also need to store this references in the DB when someone completes the form (making an order with choosen products). This forms are displayed as StackedInline (the ModelAdmin is for the Order).
I don't know how many options there may be per product so I was thinking to use this design to track orders:
Order(customer, status, notes, tot_price, inserted_by)
OrderItem(rel_order, catalog, product, unit_price)
But I don't know how to store the dynamic added inputs...
I was thiking to implement OrderItemProperty(rel_orderitem, rel_productdetail, rel_productattribute) to store each single input... but how do I loop over this unknown fields?
Maybe do you suggest a better design?
If you need more code just ask for it and I'll reply with a pastebin link.
Thankyou.
Finally I got a working solution,
I've created a custom view, overriding the default "add/" view, this way I can customize whatever I want to and I can read the POST data handling each validation, putting then the data in the right model.