Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "reference_id" colum (item table) to keep an array data #43

Open
developez opened this issue Mar 23, 2016 · 4 comments
Open

Use "reference_id" colum (item table) to keep an array data #43

developez opened this issue Mar 23, 2016 · 4 comments

Comments

@developez
Copy link

Hello

I am dealing with you great package, I want to propose to keep more data in the item table when you don't use a class. At this moment you can keep the sku, price and a id key of a certain class. But if you need to keep an array of ids for example (in my case, array of ids of two classes) you need to modifiy the table, I would to reuse the reference_id column that is null when you create a item without associated class, like this:

        $item_data = array();
        $item_data["myclass1"] = $oferta_tipo_id;
        $item_data["myclass2"] = $oferta_fecha_id;
        $item_data["sku"] = "...";
        $item_data["price"] = 100;
        $carro->add($item_data);

The idea is to retrieve this array when you read the items in the future:

foreach($items as $item)
    $item->getObjectAttribute

I can prepare a PR in this way if the owner wants.

@amsgames
Copy link
Owner

The item table is not a product table, that is why it doesn't hold more
data in it.

This gives you freedom to create your own custom product tables with the
properties of your needs.
On Mar 23, 2016 3:20 AM, "Daniel López" [email protected] wrote:

Hello

I am dealing with you great package, I want to propose to keep more date
in the item table. At the moment you can keep the sku, price and a id from
a certain class. But if you need to keep an array of ids for example (in my
case, array of ids of two classes) you need to modifiy the table, I would
to reuse the reference_id column that is null when you create a item
without class associate, like this:

    $item_data = array();
    $item_data["myclass1"] = $oferta_tipo_id;
    $item_data["myclass2"] = $oferta_fecha_id;
    $item_data["sku"] = "...";
    $item_data["price"] = 100;
    $carro->add($item_data);

The idea is to retreive this array when you read the items in the future:

foreach($items as $item)
$item->getObjectAttribute

I can prepare a PR in this way if the owner wants.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43

@developez
Copy link
Author

Yes, I understand. But with "class" and "reference_id" columns you can only
store one id of a class. If you want to store two ids, you must create
another class with these two ids in two properties or something, and save
that class to a table.

I wonder how to get a good way to obtain a general method to store two o
more id using "class" and "reference_id" columns. I want to avoid
personalice the item tabs with more fields.

In my local fork (not yet uploaded) I did modification to achieve this, so
probably it would'nt like everyone. I mean using reference_id to store an
array of ids, by the moment encoding an array in json.
The item table is not a product table, that is why it doesn't hold more
data in it.

This gives you freedom to create your own custom product tables with the
properties of your needs.
On Mar 23, 2016 3:20 AM, "Daniel López" [email protected] wrote:

Hello

I am dealing with you great package, I want to propose to keep more date
in the item table. At the moment you can keep the sku, price and a id from
a certain class. But if you need to keep an array of ids for example (in
my
case, array of ids of two classes) you need to modifiy the table, I would
to reuse the reference_id column that is null when you create a item
without class associate, like this:

$item_data = array();
$item_data["myclass1"] = $oferta_tipo_id;
$item_data["myclass2"] = $oferta_fecha_id;
$item_data["sku"] = "...";
$item_data["price"] = 100;
$carro->add($item_data);

The idea is to retreive this array when you read the items in the future:

foreach($items as $item)
$item->getObjectAttribute

I can prepare a PR in this way if the owner wants.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#43 (comment)

@amostajo
Copy link
Collaborator

That approach sounds good.
On Mar 25, 2016 9:53 AM, "Daniel López" [email protected] wrote:

Yes, I understand. But with "class" and "reference_id" columns you can only
store one id of a class. If you want to store two ids, you must create
another class with these two ids in two properties or something, and save
that class to a table.

I wonder how to get a good way to obtain a general method to store two o
more id using "class" and "reference_id" columns. I want to avoid
personalice the item tabs with more fields.

In my local fork (not yet uploaded) I did modification to achieve this, so
probably it would'nt like everyone. I mean using reference_id to store an
array of ids, by the moment encoding an array in json.
The item table is not a product table, that is why it doesn't hold more
data in it.

This gives you freedom to create your own custom product tables with the
properties of your needs.
On Mar 23, 2016 3:20 AM, "Daniel López" [email protected] wrote:

Hello

I am dealing with you great package, I want to propose to keep more date
in the item table. At the moment you can keep the sku, price and a id
from
a certain class. But if you need to keep an array of ids for example (in
my
case, array of ids of two classes) you need to modifiy the table, I would
to reuse the reference_id column that is null when you create a item
without class associate, like this:

$item_data = array();
$item_data["myclass1"] = $oferta_tipo_id;
$item_data["myclass2"] = $oferta_fecha_id;
$item_data["sku"] = "...";
$item_data["price"] = 100;
$carro->add($item_data);

The idea is to retreive this array when you read the items in the future:

foreach($items as $item)
$item->getObjectAttribute

I can prepare a PR in this way if the owner wants.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
<#43 (comment)


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43 (comment)

@developez
Copy link
Author

I've seen some ways:

class = "Array"
reference_id = "'class1_id' => 12, ...

class = "Array"
or reference_id = "142, 767, ..."

class = "Class1, Class2, ..."
reference_id = "12, 874, ..."

I need to this because I am selling products with two involved classes.
El 25/3/2016 17:06, "Alejandro Mostajo" [email protected] escribió:

That approach sounds good.
On Mar 25, 2016 9:53 AM, "Daniel López" [email protected] wrote:

Yes, I understand. But with "class" and "reference_id" columns you can
only
store one id of a class. If you want to store two ids, you must create
another class with these two ids in two properties or something, and save
that class to a table.

I wonder how to get a good way to obtain a general method to store two o
more id using "class" and "reference_id" columns. I want to avoid
personalice the item tabs with more fields.

In my local fork (not yet uploaded) I did modification to achieve this,
so
probably it would'nt like everyone. I mean using reference_id to store an
array of ids, by the moment encoding an array in json.
The item table is not a product table, that is why it doesn't hold more
data in it.

This gives you freedom to create your own custom product tables with the
properties of your needs.
On Mar 23, 2016 3:20 AM, "Daniel López" [email protected]
wrote:

Hello

I am dealing with you great package, I want to propose to keep more
date
in the item table. At the moment you can keep the sku, price and a id
from
a certain class. But if you need to keep an array of ids for example
(in
my
case, array of ids of two classes) you need to modifiy the table, I
would
to reuse the reference_id column that is null when you create a item
without class associate, like this:

$item_data = array();
$item_data["myclass1"] = $oferta_tipo_id;
$item_data["myclass2"] = $oferta_fecha_id;
$item_data["sku"] = "...";
$item_data["price"] = 100;
$carro->add($item_data);

The idea is to retreive this array when you read the items in the
future:

foreach($items as $item)
$item->getObjectAttribute

I can prepare a PR in this way if the owner wants.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
<
#43 (comment)


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
<
https://github.com/amsgames/laravel-shop/issues/43#issuecomment-201341352>


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#43 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants