Add to Cart Form in other pages in Ubercart for Drupal 6,7


Rakesh Kumar

1)Add to Cart button anywhere using the following PHP code in Drupla 6:Enable 

<?php $node1 =  node_load(1)?> <?php print theme(‘uc_product_add_to_cart’, $node1) ?>

2)Add to Cart button anywhere using the following PHP code in Drupla 7:Enable PHP Text filter Module
In Drupla7 there is little bit of change for getting Data. theme_uc_product_add_to_cart() now actually takes the whole form as a variable instead of the node.Now Use this

<?php
$node = node_load(1);
$add_to_cart = array( '#theme' => 'uc_product_add_to_cart',
'#form' => drupal_get_form('uc_product_add_to_cart_form_' . $node->nid, $node), );
print drupal_render($add_to_cart);
 ?>

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s