Hi all,
I would like to add another set of "Into Cart" buttons into the product description. I would like to have a short informational text, the first set of buttons,and more, in depth text followed by another set.
Something like this:
TEXTTEXT ---------
TEXTTEXT|image|
TEXTTEXT|image|
TEXTTEXT ---------
TEXTTEXTTEXTTEXT
====ADD TO CART===
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
====ADD TO CART===
Is this possible? Can this be done without installing another contribution?
Latest News: (loading..)
More "Into Cart" button in the middle of article description
Started by NewBudda, Mar 19 2010, 21:09
8 replies to this topic
#1
Posted 19 March 2010, 21:09
Open Source Newsletter: PhPList
Open Source Questionnaire: Lime Survey
Open Source Questionnaire: Lime Survey
#2
Posted 19 March 2010, 23:39
NewBudda, on 19 March 2010, 21:09, said:
Hi all,
I would like to add another set of "Into Cart" buttons into the product description. I would like to have a short informational text, the first set of buttons,and more, in depth text followed by another set.
Something like this:
TEXTTEXT ---------
TEXTTEXT|image|
TEXTTEXT|image|
TEXTTEXT ---------
TEXTTEXTTEXTTEXT
====ADD TO CART===
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
====ADD TO CART===
Is this possible? Can this be done without installing another contribution?
I would like to add another set of "Into Cart" buttons into the product description. I would like to have a short informational text, the first set of buttons,and more, in depth text followed by another set.
Something like this:
TEXTTEXT ---------
TEXTTEXT|image|
TEXTTEXT|image|
TEXTTEXT ---------
TEXTTEXTTEXTTEXT
====ADD TO CART===
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
MORETEXTMORETEXT
====ADD TO CART===
Is this possible? Can this be done without installing another contribution?
Avoid the most asked question. See How to Secure My Site and How do I...?
#3
Posted 20 March 2010, 00:10
I tried that and it went horribly wrong. The whole description part went funny. Which part is the EXACT part that covers the buttons?
Open Source Newsletter: PhPList
Open Source Questionnaire: Lime Survey
Open Source Questionnaire: Lime Survey
#4
Posted 20 March 2010, 01:10
NewBudda, on 20 March 2010, 00:10, said:
I tried that and it went horribly wrong. The whole description part went funny. Which part is the EXACT part that covers the buttons?
tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART)
Getting it to work in the description is another thing altogether. Perhaps...
<?php tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
I doubt that will work, but if it doesn't then you found another way it doesn't work.
Avoid the most asked question. See How to Secure My Site and How do I...?
#5
Posted 20 March 2010, 01:12
Quote
tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART)
Has noone else done this?
Open Source Newsletter: PhPList
Open Source Questionnaire: Lime Survey
Open Source Questionnaire: Lime Survey
#6
Posted 20 March 2010, 01:20
NewBudda, on 20 March 2010, 01:12, said:
Thats what I kept copied and pasting. Doesn't work 
Has noone else done this?
Has noone else done this?
tep_draw_hidden_field('products_id', $product_info['products_id'])
It is a hidden field that feeds the product_id into the variables passed to the shopping cart. Since this code does not appear until just before the 'add' button then the product id is not known to the code until execution of the code reaches this point. So you have another problem. You will have to move this hidden field (and any others found) to a point before the description in order for the product id (and any others) to be passed.Then you still have the possibility that the handling of the description field has so much stripped out or processed that you just will not be able to use php code within the description. (I've never tried it.) You could use a straight html code but run the risk of losing the osCid in the process.
Avoid the most asked question. See How to Secure My Site and How do I...?
#7
Posted 23 March 2010, 14:37
<?php tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
That does not work either I am running out of ideas...
Open Source Newsletter: PhPList
Open Source Questionnaire: Lime Survey
Open Source Questionnaire: Lime Survey
#8
Posted 23 March 2010, 15:04
The product description text is handled as a big blob of text/HTML, and simply thrown over the wall to the browser. Any PHP code within it isn't going to be processed, because osC isn't architected to expect PHP code in the middle of a product description.
Any solution to this could involve some fairly extensive modifications to osC. One solution may be to implement the additional button as a hard-coded HTML form in the middle of the product text. You would have to look at the existing button's HTML text (View > Page source in the browser) and replicate that somehow by hand. You can't wrap it all up in a nice PHP function call, because PHP isn't run against this code.
A variation of the above would be to implement the button in a JavaScript function, and call it from within <script> tags in the middle of your product description. You would have to define the JS function somewhere to handle the button and have the same effect as clicking on the existing button. If you're going to go this far, you might as well change the existing button to use the same method -- the code is cleaner that way.
Any solution to this could involve some fairly extensive modifications to osC. One solution may be to implement the additional button as a hard-coded HTML form in the middle of the product text. You would have to look at the existing button's HTML text (View > Page source in the browser) and replicate that somehow by hand. You can't wrap it all up in a nice PHP function call, because PHP isn't run against this code.
A variation of the above would be to implement the button in a JavaScript function, and call it from within <script> tags in the middle of your product description. You would have to define the JS function somewhere to handle the button and have the same effect as clicking on the existing button. If you're going to go this far, you might as well change the existing button to use the same method -- the code is cleaner that way.
#9
Posted 23 March 2010, 15:46
OK. I only understodd half of this, but its clear that this is very complicated.
I saw this on other stores and thought it could be easily done. Especially from the SEO point of view it makes sense to try this...
Well, I cant code the proposed changes and know noone who can. Should there be anyone who has done this before, I would buy the solution of him/her, but short of that I think I will have to be happy with what I got.
Thank you for the clarification!
I saw this on other stores and thought it could be easily done. Especially from the SEO point of view it makes sense to try this...
Well, I cant code the proposed changes and know noone who can. Should there be anyone who has done this before, I would buy the solution of him/her, but short of that I think I will have to be happy with what I got.
Thank you for the clarification!
Open Source Newsletter: PhPList
Open Source Questionnaire: Lime Survey
Open Source Questionnaire: Lime Survey














