Hello again,
First of all, I want to say a big thanks for the great cart ... Congrats to all the people behind it, it's quite a piece of work!
I dived deep in the code, got my hands dirty and I'm really glad I did it because I manged to modify a bit OC to play the way I wanted. It's quite a pleasure working with it and fun. No more headaches However, I got to a point where I might need a little bit of push... I added some new custom text fields and file uploaders to the checkout page, according to the quantity and product information (please see the attached screenshot). Now, I need a way to relate my custom information to the current session so when / if the session is destroyed and the order is not carried out, the whole circus also gets wiped out . I already have a new table waiting ready to tuck in the custom information ... but don't know how to pull out the current session_id ...
Any advice would be greatly appreciated!
Thanks a mil.
First of all, I want to say a big thanks for the great cart ... Congrats to all the people behind it, it's quite a piece of work!
I dived deep in the code, got my hands dirty and I'm really glad I did it because I manged to modify a bit OC to play the way I wanted. It's quite a pleasure working with it and fun. No more headaches However, I got to a point where I might need a little bit of push... I added some new custom text fields and file uploaders to the checkout page, according to the quantity and product information (please see the attached screenshot). Now, I need a way to relate my custom information to the current session so when / if the session is destroyed and the order is not carried out, the whole circus also gets wiped out . I already have a new table waiting ready to tuck in the custom information ... but don't know how to pull out the current session_id ...
Any advice would be greatly appreciated!
Thanks a mil.
Hmm..
I envision that you'd want things to be a little different. Take a look at the site http://www.PersonalizationMall.com. You can add multiple custom lines to products there, but the secret is that each product is it's own product if it is custom.
I'd say instead of trying to add these lines on the cart page for quantities of x2.. you'd need to add text fields as new options to each product. Then all products would be their own product and you'd have the lines associated with each product, which would then keep the circus together as a single "item".
Currently the options only support one type by default, but I'm actually looking at ways to offer multiple option classes (dropdown, text, multi-select, etc)
Then the lines would be set on the product page, and the cart would look more like the attached:
I envision that you'd want things to be a little different. Take a look at the site http://www.PersonalizationMall.com. You can add multiple custom lines to products there, but the secret is that each product is it's own product if it is custom.
I'd say instead of trying to add these lines on the cart page for quantities of x2.. you'd need to add text fields as new options to each product. Then all products would be their own product and you'd have the lines associated with each product, which would then keep the circus together as a single "item".
Currently the options only support one type by default, but I'm actually looking at ways to offer multiple option classes (dropdown, text, multi-select, etc)
Then the lines would be set on the product page, and the cart would look more like the attached:
Last edited by Qphoria on Sat Nov 22, 2008 11:39 am, edited 1 time in total.
Yes, I understand your opinion and sounds pretty logic however my presentation was the client's choice so I am bound to do it that way. I am thinking that if I can manage to tie it up through a foreign key with the current user session I will also manage to "destroy" it whenever the shopping session is ended. In the end, after updating the information, it will also look as your presentation does.
I think I could do it if there would be a way to keep track of the session_id on the checkout page?
Thank you.
I think I could do it if there would be a way to keep track of the session_id on the checkout page?
Thank you.
You might like to try simply persisting the data in the cart object so that it has the same lifetime and scope as the list of products and options currently saved there.
This also makes good design sense because the additional information is related to the products selected.
This also makes good design sense because the additional information is related to the products selected.
This is also a very good idea... and simpler than what I had in mind. Also, already have in the cart's object the custom text fields structure information that I'm generating the forms based on ... I think I could have the fields contents as well...You might like to try simply persisting the data in the cart object so that it has the same lifetime and scope as the list of products and options currently saved there.
This also makes good design sense because the additional information is related to the products selected.
Thank you Bruce!
ha, ha, ha ... you're damn right! can't live with them, can't live without themQphoria wrote:Those are 2 words that don't go togetherremb wrote: Yes, I understand your opinion and sounds pretty logic however my presentation was the client's choice so I am bound to do it that way.
Ok, stuck again. As I said, the idea with persisting the data into the cart object is great but putting the information in the actual products array so it can be handled on cart.tpl it's a mistery to me
Here's what I'm doing
on /catalog/controller/cart.php, function index(), has a condition if ($request->isPost()) and I'm thinking I should do it this way:
I cannot do it inside the index() function because right after the isPost() condition comes
and it's killing my $_POST
I'm sorry but just starting to learn Open Cart's structure and I might not be thinking at the best working methods so I really need your help here.
Thanks a lot!
Here's what I'm doing
on /catalog/controller/cart.php, function index(), has a condition if ($request->isPost()) and I'm thinking I should do it this way:
Code: Select all
if ($request->get('custom_fields', 'post')) {
foreach ($request->get('custom_fields', 'post') as $product_id => $fields) {
// pass $fields to /library/cart/cart.php , $this->products, where the actual products array is built
}
}
Code: Select all
$response->redirect($url->ssl('cart'));
I'm sorry but just starting to learn Open Cart's structure and I might not be thinking at the best working methods so I really need your help here.
Thanks a lot!
Hmm.. lets first try to understand what you are doing.
- You add an item, "Product 1" to the cart.
- On the cart page you want to see the normal cart, and below it you want to see 4 text boxes for that product:
- Now you add another item, "Product 2" to cart.
- On the cart page you want to see the normal cart with 2 items in it and 4 text boxes for each product
Now if you update the qty for Product 1 on the cart page you want to see:
Is that right?
That being the case, you need a form submit to update those fields so you can either at them as part of the update button for the normal cart, or add their own button.
You'd also need to set those fields to match up with a product id so something in the tpl file as part of the foreach loop for products in the cart. Something like
Then you can use
Really its messy. There's no identifier between products in the cart. If you have 10 product 1 items and 50 product 2 items you will have a huuuuuuge list of fields that will get absolutely confusing.
I think you are better off adding it to the product and giving a new proposal to your client...but I digress
- You add an item, "Product 1" to the cart.
- On the cart page you want to see the normal cart, and below it you want to see 4 text boxes for that product:
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
- On the cart page you want to see the normal cart with 2 items in it and 4 text boxes for each product
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 2:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Code: Select all
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 1:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
Product 2:
|_____________________________| Line 1
|_____________________________| Line 2
|_____________________________| Line 3
|_____________________________| Line 4
That being the case, you need a form submit to update those fields so you can either at them as part of the update button for the normal cart, or add their own button.
You'd also need to set those fields to match up with a product id so something in the tpl file as part of the foreach loop for products in the cart. Something like
Code: Select all
<?php $i = 0; ?>
<?php foreach ($products as $product) { ?>
..........
#### existing code ####
.........
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][1]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][2]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][3]" value="">
<input type="text" name="textline[<?php echo $i; ?>][product_data][product_id][4]" value="">
<?php i++; ?>
</php } ?>
Then you can use
Code: Select all
if ($request->isPost()) {
.........
if ($request->gethtml('textline', 'post') != null) {
// do your code
}
.......
}
I think you are better off adding it to the product and giving a new proposal to your client...but I digress
Thank you Qphoria !
You are perfectly right, that's the functionality but everything is more organized than I could explain. Please let me pull my thoughts together and I will get back with a better explanation. Meanwhile, if you have the time, please have a look at this live example: http://dev3.e1design.us/ . Each product can have it's own number of custom text fields ... I will also send in a private message with logins to get you access to the backend. You'll notice the new "custom text" tab for the products.
Thank you, I really appreciate you had your time for me !!
Best,
Rem.
You are perfectly right, that's the functionality but everything is more organized than I could explain. Please let me pull my thoughts together and I will get back with a better explanation. Meanwhile, if you have the time, please have a look at this live example: http://dev3.e1design.us/ . Each product can have it's own number of custom text fields ... I will also send in a private message with logins to get you access to the backend. You'll notice the new "custom text" tab for the products.
Thank you, I really appreciate you had your time for me !!
Best,
Rem.
I think I finally managed to pull it out... The custom text fields are working the way I needed but it was easier to use a new table then keeping the data in the cart object. Anyways, I hacked OC with no shame but fortunately, so far, it's working the way I need it to... Maybe in the future, you'll consider a small post with basic guidelines for building OC modules?
Thanks!
Thanks!
A wiki is on the cards. I think Q might have posted something on creating modules in here somewhereremb wrote: Maybe in the future, you'll consider a small post with basic guidelines for building OC modules?
The biggest problem is there's so much to do and so few to help
Q's currently flat chat changing nappies/diapers and coding in sleep mode
Who is online
Users browsing this forum: No registered users and 49 guests