Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php help needed


mpdaddy

Recommended Posts

I am making a mod/contribution for someone to allow for comment boxes to be placed in the product_info.php pages. I have all of the code finished, but I have one small problem I cannot solve. The way it's set up now, you must be logged in to view the text input boxes. I did this because I can only get the session to hold one comment if the user is not logged in. After adding a comment to the product and adding it to the cart, it adds the comment to the session. If the user adds another comment to the same product or a different product, the first comment is then replaced in the session. This is unacceptable. My questions are

 

How can I assign that comment to that specific product in the session? The session can hold multiple products, so I believe it must be possible to hold multiple comments. I could make the comment box a product attribute, but I would be limited to 32 characters. This is also unacceptable.

 

Is there a way to seperate that product with that comment from the same product with a different comment (hope that makes sense). Example

product 1 with comment 1

product 1 with comment 2

and so on. The same way product attributes function.

 

Can this be done? Or, is the customer limited to one comment while not logged in? How does the session hold multiple products_id's? Where is the code located?

 

I know some php guru (Ian, Linda, Harald, Mr. Unknown, etc) must know how this can be done and share his/her knowledge with me.

 

You can see a demo at http://www.redtag.net/product_info.php?products_id=21. I have made the large text box viewable without logging in. All boxes can be turned on and off by check boxes in the product pages in admin. The admin can be viewed at http://www.redtag.net/admin/.

 

If you can answer just one of my questions, it would be a great help.

 

Regards

Wayne

Link to comment
Share on other sites

Look at how the cart is handled.

 

Each product holds a products_id and qty. From this the calculations are derived. If you were to follow how that qty is added to the cart, then you could basically follow the same pattern for a comment.

 

Look at how it is first added and then how it is updated.

 

Most of this takes place in the application_top.php under // Shopping Cart

Link to comment
Share on other sites

Thanks Linda. I will look into that a little closer. Now, how can I get it to add the products to the shopping cart as if it had an attribute? EX: Each item with a different comment would get added to the cart as if they were seperate. Is this possible? I have looked at the code for attributes, but it is a mumbo jumbo to me. I am no php expert and I cannot descramble that complex code. Please point me in the right direction.

 

Regards

Wayne

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...