Relations in Laravel with dynamic attributes - laravel

Imagine in ecommerce attributes and values. Ex: size (S,M,L), weight (100,200), color (red,green,blue).
Each of variations has own price:
S, 100, red : 32$
S, 200, red : 18$
S, 100, green : 25$
etc...
Administrator has possibility CRUD attributes and values in CMS. Administrator can select created attributes and values and insert price.
Do you know the way to save this prices in DB?

Related

How to display calculated field in footer in jqgrid

i have a calculated field Total which is a sum of amount + tax columns.
i am trying to display calculated field's value in footer in jqgrid, it is not coming properly, currently i am getting Nan in the footer. and also when either amount or tax column has a blank cell i am getting NaN. this is what i have tried, demo link http://jsfiddle.net/vwdxs9vb/2/
please help.
It seems to me, that the main problem is that your origin data contains items with tax:"". parseInt("", 10) is NaN. You should use, for example,
tax = parseInt(rowObject.tax || 0, 10);
instead. See http://jsfiddle.net/OlegKi/vwdxs9vb/4/

Query a Chart with C3.js

I created a simple pie chart with around 10 items (using C3.js and D3.js). Now, in a second visualization (a table) I want to know the colors of each of the items, to also represent them in the table.
Is it possible to query the chart to receive the item's name and color?
I know I can manually hardcode colors for items and just use the same colors. However, this is not applicable in my case, as the items in the pie chart vary greatly (and I don't know them yet, as it is dependent on the user), hence my question.
Quick look at the source code reveals that you are correct, it's a category10().
Further it retrieves them by a key of "data id", which appears to be the first "column" in it's data input format:
columns: [
['data1', 30, 200, 100, 400, 150, 250], //<-- data1 is id
['data2', 130, 340, 200, 500, 250, 350]
]
You can inspect which are used by:
> chart.internal.color('data1')
"#1f77b4"
> chart.internal.color('data2')
"#ff7f0e"

Category colors in SSRS chart

I have a bar chart in SSRS that has one category group and no series groups. What I would like to know is if there is any way I can have each category show up as a different color, rather than all of them being a single color like SSRS wants to do?
The only way I know of to do this is to hard code the colors for each category in the Values' Properties -> Fill tab -> Color expression:
=IIF(Fields!DISPUTE_TYPE.Value = "Duplicate", "Red",
IIF(Fields!DISPUTE_TYPE.Value = "Eligibility", "Orange",
IIF(Fields!DISPUTE_TYPE.Value = "Corrected billing", "Green",
IIF(Fields!DISPUTE_TYPE.Value = "Additional information - Records", "Blue", "Yellow"))))
The downside is that you have to account for all values else they'll use the last "default" value (yellow in this code).
You could number each type in your query and use that number in a formula to create colors.

How to filter by attributes in layered navigation Magento?

I have two attributes in my Admin: Color and Size.
This attributes haves this configuration:
Scope: global
Catalog input type: Drop down
Apply To: all
Use in layered navigation: Filterable with results
And I have configurable products that haves simple products. For example:
CONFIGURABLE: MY T-SHIRT
SIMPLE 1: MY T-SHIRT with Color = White and Size = L
SIMPLE 2: MY T-SHIRT with Color = Black and Size = L
CONFIGURABLE: MY OTHER T-SHIRT
SIMPLE 1: MY OTHER T-SHIRT with Color = White and Size = S
SIMPLE 2: MY OTHER T-SHIRT with Color = Black and Size = M
But I cant't see filter by "Color" or "Size" in layered navigation. I just can filter by price and subcategories.
Why are those attributes not appearing in my layered navigation?
Could possibly be one of these causing the problem:
The category is not set to be anchored. Go to the category in the admin area and go to the 'Display Settings' tab. Make sure that the 'Is Anchor' option is set to yes.
The attributes are not in the correct attribute set for the products in the category you are viewing
The products in the category do not have values for those attributes

Custom options Magento

I am struggeling with Magento custom options.
In Magento you can add custom options at a Simple product. With this option an attribute like "color" can be added. Before the customer want to add the product to his cart, he first select the custom option "color". The price can change at every color.
But the options are very individual. I want the options are dependent on each other.
Something like this:
lenght = 100cm -> wood type: 1 = 120 euro total-> color: green = 140 euro total
-> color: grey = 150 euro total
wood type: 2 = 130 euro total-> color: green = 150 euro total
-> color: grey = 160 euro total
lengt = 120cm -> wood type 1: = 130 euro total-> color: green = 160 euro total
-> color: grey = 170 euro total
wood type 2: = 140 euro total-> color: green = 180 euro total
-> color: grey = 190 euro total
A store that I know that use it is:
http://www.zelfbouwmeubels.nl/tafels/eettafel/
And then select "SAMENSTELLEN".
Do i need an plugin for it or is there an default functionality in Magento.
Consider using a configurable product instead of a simple product, and download a module that will use the selected simple product's pricing. Then you can individually manage each length/wood-type/colour option as an individual SKU and charge different prices for each.
Configurable products:
http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product
Module to do what you want:
http://www.magentocommerce.com/magento-connect/Matt+Dean/extension/596/simple-configurable-products

Resources