The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
HTML image change in Template
I'm not that strong of a coder and so I need a little help. This is going to be two questions, so I'm going to first start with the image change. What is different about the image change on this is that I can not make the changes in the BBCode Manager, I have to make the changes in the individual templates for each code.
First original code: Code:
Customize Template: vbpcsi_add_to_cart_link <div> <a href="{vb:raw url}"> {vb:rawphrase vbpcsi_add_to_cart} </a> </div> Code:
<div> <a href="{vb:raw url}"> <img src="http://www.address.to.image "alt="{vb:rawphrase vbpcsi_add_to_cart, {vb:raw url}}"title=" {vb:rawphrase vbpcsi_add_to_cart, {vb:raw url}}" / > </a> </div> The first question is making the image change. When you select the button it will be added to your shopping cart. I would like a new button that says, "Thank You!" to take the place of the, "Add To Cart" button. The second question, remember that I'm new so I may need a little more in depth instruction than most, is I need to create additional codes that are based off the current codes, but will have different buttons. A little better example: Product button to go to the store where the item is located is created and I have a template to modify. Using basically the same template, but I need to create a new one that will have a different button on it than, "View Item". How do I make a fresh template for that? I hope one of you coders can help me out, I will really appreciate it! |
#2
|
|||
|
|||
I think what you want to do is make the image src a template variable, like this:
Code:
<div> <a href="{vb:raw url}"> <img src="{vb:raw img_url}" alt="{vb:rawphrase vbpcsi_add_to_cart, {vb:raw url}}"title=" {vb:rawphrase vbpcsi_add_to_cart, {vb:raw url}}" / > </a> </div> |
#3
|
||||
|
||||
kh99,
I appreciate the answer but it is not clear enough for my full understanding. Let me give you a little more detail. Add to Cart BBCode from Code Manager Code:
Title: Add To Cart BB Code Tag Name: ADDCART Replacement: <a href="{param}">ADDCART</a> Example: [ADDCART]B00078MG5M[/ADDCART] Code:
Customize Template: vbpcsi_add_to_cart_link <div> <a href="{vb:raw url}"> {vb:rawphrase vbpcsi_add_to_cart} </a> </div> With this current code, I can add a link to an item in my vB forum, and after you select it with a mouse click it will redirect you back to the thread that you are on, but if you select the checkout image or products page, then all items you selected will be there. My images are just little png files that I create to take the place of a hyperlink by using the BBCode. However, when I used the BBCode Manager to create the links to the "hyperlink images", it messed up. They told me that if I wanted to add images it would need to be from the template design. I would show you how it works, but my site is still under development. You can as a guest at least see the store integration, but as a guest you will not be able to view links. Check it out here: http://www.place4musicians.com P.S. If you see the Koi in the cart, that was from me setting up an example for someone I was going to do the design for. |
#4
|
|||
|
|||
Hmm...well, I can see what they mean. There really isn't any way to do what you want in the bbcode. You could do it in the template, but you'd have to find the php code that handles the template then make changes there. If the template is named vbpcsi_add_to_cart_link then somewhere there must be code that looks some thing like:
Code:
$template = vB_template::create('vbpcsi_add_to_cart_link'); $template->register('url', $url); $something = $template->render(); and you'd have to add code to figure out what image you want and call $template->register() to add it to the template (and also add the vb:raw tag like I mentioned before). |
#5
|
||||
|
||||
Just for a rough variation of the question, is there a way to use an "if" statement to call on the second image after click of the mouse within the original template document? If I use the correct commands and have two different <img src= locations could I get it to work that way?
|
#6
|
|||
|
|||
It depends on how the cart system works. You could use some javascript to change the image when it's clicked, but then the server won't know the item's in the cart until it gets told somehow. But you could use an "ajax" call to do that (it's a pretty common thing to do, but a little more complicated).
|
#7
|
||||
|
||||
Right now the "Add to Cart" is set up on a redirect to bring the user back to the vB thread they are on, so I'm taking a shot in the dark and thinking that changing the button my not be possible or if it is possible, that the change may not be worth the effort.
thanks kh99 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|