Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get quantity from product list (index.php) to produc_info.php when needed


lodfredy

Recommended Posts

Hello to everyone.

 

This is my first post, i have a couple of weeks using oscommerce trying to make a customized online shop and i have 2 problems, one of them is that i explain in this post, the another one will be explained in another post.

 

I am using the following code to show a quantity box in the product_listing.php page and i get correctly the value in cart_shop.php, the problem is when the product has attributes, cause it redirects me to product info page (where i have the quantity box too), then that i want is to put the value typed from product_listing.php to product_info.php (in this way, the customer does not need to type the value again) but i dont know how to do it,

 

this is the part of the code from product_listing.php

 

case 'PRODUCT_LIST_PRICE':
if (tep_not_null($listing['specials_new_products_price'])) {
$prod_list_contents .= ' <tr><td align="center"><span class="izq"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del></span>  <span class="productSpecialPrice izq">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><span class="der">';
if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$prod_list_contents .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">Detalles</a>';
} else {
$prod_list_contents .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">Detalles</a>';
}
$prod_list_contents .= '</span></td></tr>';
} else {
$prod_list_contents .= ' <tr><td align="center"><span class="izq">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><span class="der">';
if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$prod_list_contents .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">Detalles</a>';
} else {
$prod_list_contents .= ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">Detalles</a>';
}
$prod_list_contents .= '</span></td></tr>';
}
break;

 

and this is the code in application_top.php

 

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
 if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
	 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
 } else {
 //modification by Alexander Dimelow (www.web-project.co.uk)
 if(!isset($HTTP_POST_VARS['buyqty'])) {
 $quantity = 1;
 }else{
 $quantity = $HTTP_POST_VARS['buyqty'];
 }
 //end of modification by Alexander Dimelow (www.web-project.co.uk)
 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity);
 }
						 }
						 tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						 break;

 

this is the code on product_info.php

 

<div class="buttonSet">
<?php $buyqty=isset($HTTP_POST_VARS['buyqty'])?$HTTP_POST_VARS['buyqty']:"1";?>
<span class="buttonAction"><span class="text"><?php echo tep_draw_input_field('buyqty', $buyqty, 'size="3" style="vertical-align:middle;"');?> </span> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
</div>

 

I dont know how to pass "buyqty" variable, for shopping cart is working very well,

 

I hope you understand me, i am not a good english speaker, in case that not, tell me and i will try to explain me again.

 

Thanks in advance.

Link to comment
Share on other sites

Can you provide a link to your site so I can have a look?

I prefer not do that, but i can post some screenshots to understand what i want to do.

 

In the first screenshot i put the quantity of 30 int the product list page then i click the button "buy now" (which is not displaying actually, another of the question i will make later)

 

http://imageshack.us/a/img855/9285/8xs8.png

 

int the second screenshot i have the quantity box with quantity "1", i want to pass the 30 quantity from product list page

 

http://imageshack.us/a/img59/4643/huwq.png

 

 

Thanks in advance.

Link to comment
Share on other sites

I found this code but does not work for me.

 

$back = sizeof($navigation->path)-2;

       if (isset($navigation->path[$back])) {
         echo tep_draw_button(IMAGE_BUTTON_CONTINUE_SHOPPING, 'triangle-1-w', tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']));
       }

 

The problem is with sizeof($navigation->path), this is returning a "0".

 

Thanks in advance.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...