I have to display a product on magento 1.9 which has 5 distinct attributes that determine price, namely:
1, Size (9,14,18)
2, Metal (Gold, Silver)
3, Gender (Women, Men)
4, Stone (Diamond, Swarovsky)
I have made the attribute(configurable) for each and added to attribute set. Each one of these would alter the price based on drop down selection.
How can i make it work making it dynamic price such as the price will change dynamically based on each drop down selection. for example:
Blockquote
1, Size->Metal->Gender->Stone
2, 9->Gold->Set->Diamond = $5000
3, 9->Gold->Set->Swarovsky = $3000
4, 9->Silver->Women->Diamond = $4500
Blockquote
So we have multiple options here for price selection. Is this something magento can handle or only option is to use a third-part extension.
Do you know any free third-party extension for this or any way it can be coded to upload xml,csv files of these combination allowing the price to change every time the user selects different option.
Thanks.
Related
Hope you are doing well.
I need to ask about how to set up a simple product to be able to show it to my configurable associated products.
I think I already configure all the attributes like,
visibility = not show individually
stock = in stock
price = also set
status = enable
anything I missed? Because when go to my configurable product there is nothing as Associated Products.
Any help appreciated.
Hello Quan,
To associate them
not needed:
visibilty = not show inidividually
stock = in stock
price = also set
status = enable
needed:
attribute set = the same as configurable product (check configurable product attribute in admin section)
to create a config
Beside this you need to make sure, that the attributes you want to be configurable are NOT system, "Global", input type "Dropdown" and "allowed for configurables"
to show them in frontend
Only the simple ones which are in stock and enabled are shown in frontend, might be an indexing issue?
Thanks!
I have list of images in a table (create table id, name, sequence). I want to arrange objects in a certain sequence.
e.g.
1, "rose", 1
2, "jasmine", 2
3, "lilly", 3
If I move "lilly" in front of "rose", the sequence would be as follows
1, "rose", 2
2, "jasmine", 3
3, "lilly", 1
Is there a way to automatically achieve this via a gem, since I don't want to update all sequence values in the table by writing update code myself.
You can use the ActsAsList gem, which does the position updating work for you when you change the position of a record.
I am asked to allow users to input multiple values in EVERY field. So the option is limitless.
For example. Columns are:
CompanyID-
Company name
Website
Key_Markets
M&A_History
Highlights
Region
Comments
A scenario is a company can have multiple websites,key markets, region, etch. How would I do this professionally? I am thinking of putting every column a seperate table.
Basically there are three ways to realize this.
1) Write multiple fields into one column seperately. This would be a very bad design and you would have to handle the splitting in your application - Do not do that ;-)
2) Use one table with multiple groups to store the data. This would make sense for parameters but not really if you have different values for each customer. For example:
CompanyID
GroupID
Position
Value
Example:
108001, 'homepage', 1, 'www.mypage.com';
108001, 'homepage', 2, 'www.mysecondpage.com';
108001, 'homepage', 3, 'www.anotherpage.com';
108001, 'markets', 1, 'erp';
108001, 'markets', 2, 'software';
108001, 'region', 1, 'germany';
108001, 'region', 2, 'austria';
108001, 'region', 3, 'poland';
3) Use seperate tables for each 1:n relation! This would be the best solution for your needs I guess. This would have the advantage that you can easily extend your schema and store more data in it. For example if you decide to store the amount of users for each region or key markets etc.
Another point: Use n:m relations to avoid double content in your database! For example should the key-markets and regions be stored in a completely seperated table and you store the IDs of the customer and the key-market in a crosstab. So you do not need to store the key-markets as a string for each customer!
You would need a database structure like:
table_master_companies
- record_id
- company_name
table_websites
- record_id
- company_id
- website_address
table_key_markets
- record_id
- company_id
- key_market
etc. You would then need to use joins to concat all the information into a single recordset.
The tree has the following characteristics:
Each node can have multiple parents and multiple children.
The Parent nodes of a Node can have different depth.
Example
I am trying to represent a category structure such as the following:
Desktop and Mobile Applications
Desktop and Mobile Applications->Android Apps
Desktop and Mobile Applications->Android Apps->Games
Desktop and Mobile Applications->Android Apps->Games->Action
Desktop and Mobile Applications->Games
Desktop and Mobile Applications->Games->Action
Desktop and Mobile Applications->Games->Adventure
Desktop Applications
Desktop Applications->Games
Desktop Applications->Games->Action
Desktop Applications->Games->Adventure
IPhone Applications
Desktop Applications->Games
Desktop Applications->Games->Action
Desktop Applications->Games->Adventure
Tried using the Nested Set Algorithm and I end up with multiple "Games" categories with different categoryIDs and at different depths.
Any help with this will be much appreciated.
The simple way is to structure a table like:
Categories
CategoryID
ParentID
Name
Your data would look like:
1, 0, 'Desktop and Mobile Apps'
2, 1, 'Android Apps'
3, 2, 'Games'
4, 3, 'Action'
5, 1, 'Games'
6, 5, 'Action'
7, 5, 'Adventure'
8, 0, 'Desktop Apps'
9, 8, 'Games'
You would query it like:
select * from Categories where ParentId = 1 which would return Android Apps and Games. To get the sub categories of games you would do select * from Categories where ParentId = 5 which would return action and adventure.
update
In order to associate a single item with multiple categories you will want one additional table:
xref_CategoriesItems
CategoryId
ItemId
This would allow any single item to be associated with multiple categories. Let's say you have a desktop app that needs to appear with both Desktop Apps > Games and Desktop and Mobile Apps > Games.
Your table would have the following data for item 1:
3, 1
9, 1
When seeing what items were in a specific category you would do the following:
select I.*
from items I
inner join xref_CategoriesItems XCI on (XCI.ItemId = I.ItemID)
WHERE (XCI.Category = #CategoryId)
To see which categories a specific item falls under:
select C.*
from categories C
inner join xref_CategoriesItems XCI on (XCI.CategoryId = C.CategoryId)
where (XCI.ItemId = #ItemId)
The query for all items under a specific category is a little more complex if you need all of the child records. Basically you need to do a recursive join the xref_categories with the categories to get the children. I don't remember how to express that in MySQL's version of sql; however the following might be good to know: Using MySQL query to traverse rows to make a recursive tree
What you are asking for is not really a tree, but a graph. Especifically it's a Directed Acyclic Graph (DAG). Here it's a link speaking about storing DAGs in a relational database.
It might be easier to just go with a traditional tree structure for the categories, and allow for items to be in multiple categories with the help of a item/category linking table.
An alternative approach would be to use tags on whatever items you are storing instead of categories. From the example you give, that may even be more appropriate - instead of "Desktop and Mobile Applications", "Desktop Applications" and "Mobile Applications", you would use the "Desktop" and "Mobile" tags. An item with both would then naturally fall into the first category.
Ref: How to store tags in MySQL tags, one field in total or one filed for each tag?
I'm looking for the best way to design a shopping cart. I'm at a crossroads with how to handle a product that has multiple options being color and size. The main issue being inventory management for the colors and sizes.
Currently on admin panel:
textfield for color
textfield for quantity
User seperates colors by comma along with quantity so color & quantity match when I explode/implode them into arrays, thus allowing me to manage the quantity whenever something is purchased by their keys after doing an array search for the color.
Right now I just have one table holding upc/name/color/quanity/price etc...
Should I be using some type of foreign key and having tables for color/quantity on their own?
This is more of a design question and not a show me exactly how to do it question as I'm just trying to learn the most optimum way to manage a database.
Thanks!
I'm not quit sure I understand your question but I think you are looking for suggestions on how to data model this and how to represent arrays of data from this model as strings that can be manipulated browser-side.
For the data model, it sounds like you need a 5 tables:
1) Product, 2) Color, 3) Size, 4) an associative table between Product and Color, 5) an associative table between Product and Size. Tables 4 and 5 implement the many-to-many relationships between products and the different colors offered, and between products and the different size offered.
Then you can settle on a standard way of representing shopping cart items as strings. Say:
<productId>,<qty>,<colorId>,<sizeId>
Arrays of these shopping cart items would be semicolon separated.
Looking for a way to represent the color and size choices for a particular product? I often use this type of query to retrieve choices as a comma-separated list which are then easy to deal with client-side:
-- =============================================
-- Author: Joe Blo
-- Create date: Jan 1, 2010
-- Description: Returns list of color choices for
-- a product in CSV format
-- =============================================
CREATE FUNCTION [dbo].[fn_GetProductColorsCSV]
(
#pProductUPC VARCHAR(30)
)
RETURNS VARCHAR(MAX)
AS
BEGIN
-- Declare the return variable here
DECLARE #Result VARCHAR(MAX)
-- Add the T-SQL statements to compute the return value here
SELECT #Result = COALESCE(#Result + ',', '') + CAST(C.[ColorId] AS varchar)
FROM dbo.[ProductColorJunction] PCJ
INNER JOIN dbo.Color C ON C.[ColorId] = PCJ.Color
WHERE PCJ.ProductUPC = #pProductUPC
-- Return the result of the function
RETURN #Result
END
Why not start by exploring how open source shopping carts have handled similar tasks. osCommerce is one that comes to mind.
Use 3NF
http://www.troubleshooters.com/littstip/ltnorm.html
http://en.wikipedia.org/wiki/Third_normal_form