Originally Posted by
keneso
Thank you mc12345678
I understand what you wrote, but don't know what how to do it!
I mean where do I put
void zen_draw_form( $name, $action, [ $method = 'post'], [ $parameters = ''])
and would I just added to the code in my earlier post?
Though I am sure you got what I am trying to do, please let me detail it more:
I have a slider where the image would link to the product page, and in the caption section I put the code to add the item to cart directly, and I just added the above code there.
So if the above is something like this:
Code:
<?php //some amount of php
?><form action="http://localhost/zencart_test/index.php?main_page=product_info&cPath=65/&products_id=180/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" id="cart_quantity">
<input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
<input type="hidden" name="products_id" value="180" />
<input name="image" type="image" title=" Add to Cart " src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" />
</form><?php // other php stuff
Then would add the above like so:
Code:
<?php //some amount of php that ends at the end of this line;
zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($product_id), 'cPath=' . zen_get_generated_category_path_ids($product_id, 'product') . '&products_id=' . $product_id . '&action=add_product', $request_type), 'post', 'enctype=\"multipart/form-data\" id=\"cart_quantity\"');
?><input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
<input type="hidden" name="products_id" value="180" />
<input name="image" type="image" title=" Add to Cart " src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" />
</form><?php // other php stuff
Where $product_id is identified/set to the products_id of the product to which to link... There are other ways to present, but I figured if you have the product_id then the rest should fall in line with the above... Notice that the zen_draw_form is within the php code, not outside in the html code... Not exactly described above about how the html was being generated, so assumed that there is an opportunity to generate the html using php like above..
If instead you are going to hard code each of these links and not use the php type interface above, then need to include the code that is pushed at the end of the zen_draw_form function...
Bookmarks