Jump to content
Johnson

Master Products - MS2

Recommended Posts

looking at the link you sent that is html code and not dynamic. much different than using this, as this is a shopping cart. you can create an html page and then have it so the customer can click on that link.


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

NO you dont understand.. THat HTML you see was the OLD SITE ... we arent gonna re create that for them. I need to make that layout display work in the CART ITSELF. Meaning that in the product listings i need to modify that php file to display the items in the format shown in the html page. I see no reason to redo 100 html items when all the item data is redily available in the cart already but just not displaying in the product listings.

 

BASICALLY im needing to pull items from the product info and show it on the product listings page.

Edited by rayge

Share this post


Link to post
Share on other sites

hello

does anyone have any idea how i can list prices for the all slave product under the the product category. for ex. if i have 4 slave product and the prices are

1. 4.95

2. 6.95

3. 8.95

4. 10.95

i want to list the price under product category image from 4.95 to 9.95 not just one price of the master product.

 

thanks you

 

see this website for ex.

click on this

Share this post


Link to post
Share on other sites

Hi to all, I'm here again with another problem :blush:

 

I have installed of recent option type feature and I have realized that it doesn't work well with master product

 

Well, here following I bring you the thing that I have noticed me for that that it concerns master product and option type feature.......

 

I bring you the possible causes with relative code, I hope that someone succeeds to make to run well the 2 contribs.

 

In the file product_info.php in catalog we find this code

	<?php echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?>

while the original one is

	<?php echo tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

 

What creates problems it is the final part add_slave to the place of add_product, if in fact we also replace add_slave with add_product in case of option type selected there are no errors; but anymore however the attributes they don't work that don't use option type.

Needless to say that if I restore then the original function all of this that is tied up to master product doesn't work well.....

 

I now bring you the content of application_top.php in catalog/includes

 

add_slave:

     case 'add_slave' :
                            reset($HTTP_POST_VARS);
                            while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
                              if (substr($key,0,11) == "Qty_ProdId_") {
                                $prodId = substr($key,11);
                                $qty = $val;
                                if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
                                  // We have attributes
                                  $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]);
                                } else {
                                  // No attributes
                                  $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
                                }
                              }
                            }
                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                            break;

 

add_product:

      case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

According to me the problem is here, but I don't know how to resolve it, has tried but without success...... and I am not even sure that this that doesn't make to work option type....

 

I also bring you the piece of code of product_info.php in catalog that you should check option type in case of attributes....

<?php
// iii 030813 added: initialize $number_of_uploads
   $number_of_uploads = 0;
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by patrib.attribute_sort");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo '<BR>' . TEXT_PRODUCT_OPTIONS_PRETEXT . '<BR><BR>'; ?></td>
           </tr>
	 <tr>
             <td class="main" colspan="2"><?php echo '<b>' . TEXT_PRODUCT_OPTIONS . '</b><br>';?></td>
           </tr>
   
   
<?php
	 //clr 030714 update query to pull option_type
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
   //clr 030714 add case statement to check option type
       switch ($products_options_name['products_options_type']) {
         case PRODUCTS_OPTIONS_TYPE_TEXT:
           //CLR 030714 Add logic for text option
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "' order by pa.attribute_sort");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
           $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];
           if ($products_attribs_array['options_values_price'] != '0') {
             $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_id'], $products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
           }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo $tmp_html;  ?></td>
           </tr>
<?php
           break;
         case PRODUCTS_OPTIONS_TYPE_RADIO:
           //CLR 030714 Add logic for radio buttons
           $tmp_html = '<table>';
           $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
           $checked = true;
           while ($products_options_array = tep_db_fetch_array($products_options_query)) {
             $tmp_html .= '<tr><td class="main">';
             $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
             $checked = false;
             $tmp_html .= $products_options_array['products_options_values_name'];
             $tmp_html .= $products_options_name['products_options_comment'];
             if ($products_options_array['options_values_price'] != '0') {
               $tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_id'], $products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
             }
             $tmp_html .= '</tr></td>';
           }
           $tmp_html .= '</table>';
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo $tmp_html;  ?></td>
           </tr>
<?php
           break;
         case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
           //CLR 030714 Add logic for checkboxes
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
           echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';
           echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);
           echo $products_options_name['products_options_comment'];
           if ($products_attribs_array['options_values_price'] != '0') {
             echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_id'], $products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
           }
           echo '</td></tr>';
           break;
// iii 030813 added: support for file fields
         case PRODUCTS_OPTIONS_TYPE_FILE:
           $number_of_uploads++;
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)tep_db_input($HTTP_GET_VARS['products_id']) . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
?>
     <tr>
       <td class="main"><?php echo $products_options_name['products_options_name'] . ' (' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_id'], $products_attribs_array['options_values_price'], $product_info_values['products_tax_class_id']) . ') '; ?></td>
       <td class="main"><input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>
     </tr>
<?php
           break;
         default:
           //clr 030714 default is select list
           //clr 030714 reset selected_attribute variable
           $selected_attribute = false;
	 
	 
         $products_options_array = array();
         $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
         while ($products_options = tep_db_fetch_array($products_options_query)) {
           $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
           if ($products_options['options_values_price'] != '0') {
             $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_id'], $products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
           }
         }

         if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
           $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
         } else {
           $selected_attribute = false;
         }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

             <td class="main"><?php
    
//     echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];  
    echo tep_draw_pull_down_menu('id_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);
//     echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);
    
    ?></td>
           </tr>
<?php
       }  //clr 030714 end switch
     } //clr 030714 end while
?>

 

It serves someone who knows well master product to give me a help.

 

Make to know me, hi, jo.

 

Thanks in advance

Share this post


Link to post
Share on other sites

product quantity is either zero or one, i would like this drop down so if this is the only product, the quantity defaults to 1 with the customer able to key in how many they want. having it set to default at 0 is not working too well.

 

i am going to start at the beginning and read the thread however if someone knows the answer much appreciated.


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

ooops..posted my issue in the wrong place before. Sorry about that. This is the right place to post it, so here goes:

 

Love the MOD! Was so glad to see the slaves with attributes add on, have been waiting to install for this piece.

 

Got it working pretty well, except for one issue.

 

Now that my slaves have attributes, how do I associate specific slaves with specific master products. For instance, if I have a gift bag as a master and slave products includes two different styles of t-shirts with options for sizes. User adds one master gift bag with the first style t-shirt with size L and the second style t-shirt with size medium. So now in the shopping cart I have three items, the gift bag, the first shirt-size large and the second shirt - size medium. THen the user decides that they want another one, this one with the first t-shirt with size XL and second t-shirt size XL. Now I have the following in my shopping cart:

 

2 - gift bags

1 - 1st style t-shirt, size large

1 - 1st style t-shirt, size XL

1 - 2nd style t-shirt, size medium

1 - 2nd style t-shirt, size XL

 

These are all the right pieces, but how do I know when I'm pulling the order from the shelves which t-shirts go together in each gift bag??

 

Any help would be greatly appreciated!

 

Thanks!

Share this post


Link to post
Share on other sites
These are all the right pieces, but how do I know when I'm pulling the order from the shelves which t-shirts go together in each gift bag??
You are right, you can't know because osC doesn't put the information you need for that in the database as far as I can tell.

 

I guess it wouldn't be impossible to modify the code that you can. You could for example add an extra column to the table orders_products with the date_purchased (see table orders) that insert the date and time when the master products with slaves is inserted into that table. When another master product with slaves is added to the order, that will be a later time. That way you can (for example with PHPMyAdmin) check in the database tables what slave products are associated with what master product (because they have the same time stamp).

 

More convenient would be to also change the admin section to show the date_purchased from the table orders_products there. Even nicer would be to change the email in such a way that each gift bag is mentioned separately with the goods that go in, but this is getting even more complicated.

 

So yes, I think it can be done but not without modifying the code. Just my two cents.

Share this post


Link to post
Share on other sites

ok..here's the approach I took. I created an additional attribute called group_id and made a new option_type called hidden. Then for every product that is either a master or a slave, this attribute is automatically created for each product when a product is designated as a master or as a slave.

 

Then on the product page, I create a random number and assign it to $group_id. Then in the attributes section, if the type is hidden I draw a hidden field and set the value to $group_id. Now all the products on this page have the same value for the group_id attribute when the user hits the add to cart button. Since the group_id is an attribute it gets added to the product in the usual way.

 

Now on the shopping page, when you delete the master, I can delete the slaves by looking for the matching group_id. For the warehouse, they can group the items together by the group_id, so they know what goes where. And of course on the shopping page, if the option type is hidden, I don't show it.

 

In this particular implementation, the user cannot select a quantity for the slave products so that makes it easier to decrement quantities by one when deleting and removing the product from the shopping cart when appropriate.

 

Any comments?? or better suggestions?

Share this post


Link to post
Share on other sites
Any comments??
Excellent idea. I now realize that my idea is totally flawed since the cart is kept in the session till the order is finalized.

Share this post


Link to post
Share on other sites

I would like to disable the display of slaves with products, when a customer clicks on a category it displays the master and slave products together.

can anyone point me to the right spot?

 

thanks


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites
I would like to disable the display of slaves with products, when a customer clicks on a category it displays the master and slave products together. 

can anyone point me to the right spot?

 

thanks

 

 

In the admin, when you edit the product there is a flag called product listing display, you can select show product or hide product.

Share this post


Link to post
Share on other sites

Hi to all has someone succeeded in resolving the problem of integration among master product and option type feature?

 

Tnx, jo.

Share this post


Link to post
Share on other sites
Hi to all has someone succeeded in resolving the problem of integration among master product and option type feature?

 

Tnx, jo.

 

 

Yes..I'm currently using both of those mods...you have to go through the switch statement in product_info and for each option type case change the input field name from "id['" to the "id_$products" etc...the change that is listed in step 5 of the Master Product Slave Attributes add on to the Master Products mod...

 

I think that is what you are referring to...

Share this post


Link to post
Share on other sites

Yes :D I'm referring to this!!!!

 

Tnx very much!!!!

 

I have replace:

this

            $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];

with this

            $tmp_html = '<input type="text" name ="id_' . TEXT_PREFIX . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];

 

this

              $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);

with this

              $tmp_html .= tep_draw_radio_field('id_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);

 

this

            echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

with this

            echo tep_draw_checkbox_field('id_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

 

and this

        <td class="main"><input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>

with this

        <td class="main"><input type="file" name="id_<?php echo TEXT_PREFIX . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>

 

and does it work well, would you know how to tell me if the last substitution is correct?

 

tnx againg, jo.

Share this post


Link to post
Share on other sites
Yes :D I'm referring to this!!!!

 

Tnx very much!!!!

 

 

this

 ? ? ? ? ? ?echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

with this

 ? ? ? ? ? ?echo tep_draw_checkbox_field('id_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

 

and this

 ? ? ? ?<td class="main"><input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>

with this

 ? ? ? ?<td class="main"><input type="file" name="id_<?php echo TEXT_PREFIX . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td>

 

and does it work well, would you know how to tell me if the last substitution is correct?

 

tnx againg, jo.

 

I had trouble with the file option type as well..and since my current implementation doesn't use it, I punted on figuring it out until after this fast approaching deadline for me was met. Let me know if you figure it out!

Share this post


Link to post
Share on other sites

Hi Everyone,

 

I saw one reply earlier in this thread that asks to see a categories.php that has BOTH Header Tags Controller and MS2 installed. Unfortunately, nobody replied to that person :( .

 

I already have Header Tags Controller installed. My wife and I are pretty new with OScommerce. We're in the process of starting up a small Thai Shop using OS commerce....

 

Our question is, can we use both Header Tags Controller AND MS2? If so, what should the categories.php file look like in the admin. directory?

 

We appreciate any help with this!

Shaun & Natlada :)

 

 

This is the support thread for Master Products - MS2

 

I will not reply to postings for support elsewhere on these forums. Please do not pm or email me for support unless you give billing details  :D

 

Matti

Share this post


Link to post
Share on other sites

Hi,

 

I am using this revolutionary contribution to substitute the attribute system of OsC in the following way:

 

Master product is i.e. a shirt ( I set stock amount for MP to zero because I don`t want the select amount to show up). I don`t use master products for my stock, only slave products.

 

Slave Products are colors i.e. green, blue, red (Each slave product has amount in stock so the select amount shows up).

 

Now if a customer does not select a slave product or the number of items in product_info.php and clicks on add to cart, OsC adds the master product to the cart as amount zero.

 

Therefore it would be great if OsC could check if the customer has selected a slave product when clicking on the "add to cart" button.

 

A contribution has been posted how to solve this problem when using attributes ((Must Select Attributes).

 

These are the code snippets for checking if attributes were selected.

 

Insert in product_info.php

$products_attributes = tep_db_query("select popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");
  if (tep_db_num_rows($products_attributes)) {
    $products_attributes = '1';
  } else {
    $products_attributes = '0';
  }
//BoF CB Show must error messages include any must select msg
if ($messageStack->size('product_info') > 0) {
?>
       
               output('product_info'); ?>

 

 

Insert this code in application_top.php

// initialize the message stack for output messages
require(DIR_WS_CLASSES . 'message_stack.php');
$messageStack = new messageStack;

//BoF CB Enforce option selection
if (isset($HTTP_GET_VARS['mustselect'])){
  $error = true;
  switch ($HTTP_GET_VARS['mustselect']) {
    case 'product_info' :
     $messageStack->add('product_info','You must select a value from the options dropdown');
     break;
   case 'product_listing' :
     $messageStack->add('product_listing','You must select a value from the options dropdown for the products you are adding to cart');
     break;
  }
}
//EoF CB


the add_product section in application _top looks like:
    // customer adds a product from the products page
    case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                              //BoF CB Enforce attribute selection
                              if (is_array($HTTP_POST_VARS['id']) ) {
                                while (list($option, $value) = each($HTTP_POST_VARS['id'])) {
                                 // 9 is the value for "-select-"
                                 if ($value == 9) {
                                    tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'] . '&mustselect=product_info'));
                                    break;
                                 }
                                }
                              } elseif (tep_has_product_attributes($HTTP_POST_VARS['products_id'])) {
                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_POST_VARS['products_id']));
                                  break;
                              } 
                              //EoF CB
                              $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$quantity, $HTTP_POST_VARS['id']);
                            }
                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                            break;

 

 

How can I adapt this for checking if slave products were selected and if not to show the error message?

 

Thanks in advance ;-)

Share this post


Link to post
Share on other sites

Hi guys,

 

I have a big problem with my Master & Slave products.

 

oscommerce1.jpg

 

I cloned a MP3 download store to another server. On the orignal server two instances of this shop are running perfect. Order Download products (master & Slave), as you can see it in the picture above, works without any problem.

 

The products are send correctly to the basket and if you press the checkout button, you will be send directly to the checkout_payment.php.

 

After installing the system on another Server one big problem appeared.

 

If you order a product out of the product_info.php that produce the listing above, then the products are send to the basket, but if you want to checkout, you will be send to checkout_shipping.php and afterwards downloads do not work.

 

After checking every tiny peace of code, I found out that if I use a non modified product_info.php, then everthing works correct. Downloading is possible.

 

oscommerce2.jpg

 

I checked every detail of the configuration and as good as possible, if there is any mistake inside the script, but cant find the problem.

 

This is the code, witch produces the mistake (I think, one problem is, that products are not correctly indentified as virtual downloadable products).

 

/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
<?php
 require('includes/application_top.php');
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="style.css">
<script language="javascript">
<!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=no,copyhistory=no,width=310,height=200,screenX=0,screenY=0,top=200,left=35
0')
}
//-->
</script>
</head>
<body>
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<?php
 // Master Products EOF
 if ($product_check['total'] < 1) {
 ?>
 
 <div class="itemInfo">
   <table width='100%'>
  <tr>
    <td align='left'><b>   </b></td>
  </tr>
</table>
 </div>

 <div class="itemBody">
   
<br />

<?php include(DIR_WS_MODULES . FILENAME_NAVI_CATEGORIES); ?>

<br />

   <table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td align="center"><strong><?php echo TEXT_PRODUCT_NOT_FOUND; ?></strong></td>
  </tr>
</table>

<br />

   <table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td align="center"><input type="button" value="<?php echo BUTTON_CONTINUE ?>" onclick="location='<?php echo tep_href_link(FILENAME_DEFAULT) ?>'" class="submit" /></td>
  </tr>
</table>

<br />

 </div>
 
 <?php
 }
 else
 {
 //Master Products
 $product_info_query = tep_db_query("select p.products_id, pd.products_name, p.products_label, p.products_spiel_dauer, p.products_release_datum, p.products_titel_anzahl, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_mp3, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, p.products_date_available, p.manufacturers_id, p.label_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 //Master Products EOF
 $product_info = tep_db_fetch_array($product_info_query);
 tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
 
 if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
   $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
 }
 else {
   $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 }

// Master Status  
 $master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . " '");
 $results = tep_db_fetch_array($master_query);
 
 
 if ((tep_not_null($product_info['products_model'])) && ($product_info['products_master_status'] != 1)) {
   $products_name = '<strong>' . $product_info['products_name'] . ' </strong> ' . TEXT_PRODUCTS_AUS_ALBUM . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO . '?products_id=' . $product_info['products_master'], '', 'NONSSL') . '"> <strong>' . $product_info['products_model'] . '</strong></a>';
 }
 else {
   $products_name = '<strong>' . $product_info['products_name'] . '</strong>';
 }
 ?>
     
 <div class="itemInfo">
   <table width='100%'>
  <tr>
    <td align='left'><b><?php
      if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
     echo TEXT_PRODUCTS_ALBUM; } else { echo TEXT_PRODUCTS_TITLE; 
   }
    ?></b></td>
  </tr>
</table>
 </div>
 
 <div class="itemBody">

<br />

<?php include(DIR_WS_MODULES . FILENAME_NAVI_CATEGORIES); ?>

<br />

<?php  echo '<form name="buy_now_1" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?>
<?php
  $manufacturers_id = $product_info['manufacturers_id'];
  $category_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'");
  $category = tep_db_fetch_array($category_query);
?>
<?php if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?>
<table width="100%" border="0" cellpadding="0" cellspacing="10">
  <tr>
    <?php
 if ($product_info['products_master_status'] == 1) { ?>
      <td align="center"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_short($product_info['products_date_available'])); ?></td>
 <?php
 }
 else { ?>
      <td align="center"><?php echo sprintf(TEXT_DATE_AVAILABLE_TITEL, tep_date_short($product_info['products_date_available'])); ?></td>
 <?php } ?>
  </tr>
</table>

<br />

<?php
}
?>

<table width="100%" border="0" cellpadding="0" cellspacing="10">
  <tr>
    <td align="left" valign="top" width="<?php echo PRODUKT_INFO_IMAGE_WIDTH ?>">
   <?php
     if (tep_not_null($product_info['products_image'])) {
    echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $category['manufacturers_name'].' » '.$product_info['products_name'], PRODUKT_INFO_IMAGE_WIDTH, PRODUKT_INFO_IMAGE_HEIGHT).'<br />';
	 }
	 else {
    echo tep_draw_separator('no_img.gif', PRODUKT_INFO_IMAGE_WIDTH, PRODUKT_INFO_IMAGE_HEIGHT).'';
	 }
	 if ($product_info['products_master_status'] == 1) {
    echo tep_draw_separator('album.gif', PRODUKT_INFO_IMAGE_WIDTH, 20);
	 }
	 else {
    echo tep_draw_separator('title.gif', PRODUKT_INFO_IMAGE_WIDTH, 20);
	 }
   ?>
 </td>
 <td valign="top">
   <?php
     $parent_query = "select categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_name ='" . $category['manufacturers_name'] . "'";
	 $arr_parent_category_query = tep_db_query($parent_query);
	 $parent_category = tep_db_fetch_array($arr_parent_category_query);
   ?>

   <table border="0" align="left" cellpadding="0" cellspacing="2" width="100%">
     <tr>
          <td align="left"><strong><?php echo '<a href="' . tep_href_link(FILENAME_LISTE . '?cPath=' . $parent_category['categories_id'], '', 'NONSSL') . '">' . $category['manufacturers_name'] .'</a>'; ?></strong></td>
	 </tr>
	 <tr>
    <td align="left"><?php echo $products_name; ?></td>
	 </tr>
	 <tr>
    <td align="left">    </td>
	 </tr>
	 <tr>
    <td align="left">
      
   <table border="0" align="left" cellpadding="0" cellspacing="2" width="100%">
     <tr>
       <td align="left" width="150"><?php echo TEXT_PRODUCTS_PREIS; ?></td>
  	 <td align="left"><strong>
      <?php
      if ($product_info['products_quantity'] > 0) {
        if ($products_price > '0') {
       echo $products_price;
     }
     else {
       echo TEXT_PRODUCTS_PREIS_NEIN;
     }
      }
      else {
        echo TEXT_PRODUCTS_PREIS_NEIN;
      }
      
      ?></strong>
  	 </td>
     </tr>
     <tr>
       <td align="left" colspan="2">    </td>
     </tr>
     <tr>
       <td align="left" width="150">
      <?php
        $label_id = $product_info['label_id'];
     $category_query = tep_db_query("select label_name from " . TABLE_LABEL . " where label_id = '" . (int)$label_id . "'");
     $category = tep_db_fetch_array($category_query);
     $category['label_name'];
     echo TEXT_PRODUCTS_LABEL;
      ?>
  	 </td>
  	 <td align="left"><?php echo $category['label_name']; ?></td>
     </tr>
     <tr>
       <td align="left" width="150"><?php echo TEXT_PRODUCTS_RELEASE_DATUM; ?></td>
  	 <td align="left"><?php echo $product_info['products_release_datum']; ?></td>
     </tr>
     <tr>
       <td align="left" width="150"><?php echo TEXT_PRODUCTS_SPIEL_DAUER; ?></td>
  	 <td align="left"><?php echo $product_info['products_spiel_dauer']; ?></td>
     </tr>
     <?php
       if ($product_info['products_master_status'] == 1) { ?>
     <tr>
       <td align="left" width="150"><?php echo TEXT_PRODUCTS_TITEL_ANZAHL; ?></td>
  	 <td align="left"><?php echo $product_info['products_titel_anzahl']; ?></td>
     </tr>
     <?php } ?>
     <tr>
       <td align="left" width="150"><?php echo TEXT_REVIEW_AVERAGE; ?></td>
  	 <td align="left">
      <?php
        $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
     $reviews = tep_db_fetch_array($reviews_query);
     $reviews_query_average = tep_db_query("select (avg(reviews_rating)) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
     $reviews_average = tep_db_fetch_array($reviews_query_average);
     $reveiws_stars = $reviews_average['average_rating'];
     $reveiws_rating = number_format($reveiws_stars,0);
     
     if ($reviews['count'] > 0) {
       echo tep_image(DIR_WS_IMAGES . 'stars_' . $reveiws_rating . '.gif') . ' ' . $reviews['count'] . ' ' . TEXT_CURRENT_REVIEWS;
     //  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image(DIR_WS_IMAGES . 'stars_' . $reveiws_rating . '.gif') . ' ' . $reviews['count'] . ' ' . TEXT_CURRENT_REVIEWS . '</a>';
     }
     else { 
       echo "-";
     }
      ?>
  	 </td>
     </tr>
   </table>
    
    </td>
	 </tr>
	 <tr>
    <td valign="top">
      <?php
     $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
     $products_attributes = tep_db_fetch_array($products_attributes_query);
     if ($products_attributes['total'] > 0) {
   ?>
   <table border="0" align="left" cellpadding="0" cellspacing="2" width="100%">
     <tr>
       <td>
      <?php
        $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
       while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
         $products_options_array = array();
    	 $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
    	 while ($products_options = tep_db_fetch_array($products_options_query)) {
        $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
        if ($products_options['options_values_price'] != '0') {
          $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
        }
    	 }
       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
        $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
    	 }
    	 else {
        $selected_attribute = false;
    	 }
    	 ?>
<?php echo tep_draw_hidden_field2('id_' . $HTTP_GET_VARS['products_id'] . '[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?>
<?php
       }
       ?>
  	 </td>
     </tr>
   </table>
   <?php
     }
   ?>
   
    </td>
	 </tr>
	 <tr>
    <td valign="top">
      
   <table border="0" align="left" cellpadding="0" cellspacing="2" width="100%">
     <?php
       if ($product_info['products_price']>0) {
      $qty_array = array();
      for ($i=0; $n2 = (($product_info['products_quantity'] < 1) ? $product_info['products_quantity'] : 1), $i <= $n2; $i++) {
        $qty_array[] = array('id' => $i, 'text' => $i);
      }
     ?>
     <tr>
       <td align="right">
      <?php
        if ($product_info['products_quantity'] > 0) {
       echo '  ' . tep_draw_hidden_field2('Qty_ProdId_' . $product_info['products_id'], $qty_array);
     }
     elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
       $qty_array = array();
       for ($i=0; $ns = 1, $i <= $ns; $i++) {
         $qty_array[] = array('id' => $i, 'text' => $i);
    	 $zahl = '1';
       }
       echo TEXT_QUANTITY . '   ' . tep_draw_hidden_field2('Qty_ProdId_' . $product_info['products_id'], $qty_array);
     }
     else {
       $bestellbutton = '1';
       // echo TEXT_STOCK;
     }
      ?>
  	 </td>
     </tr>
     <?php
       }
     ?>
     <tr>
       <td valign="top">
      
      <table border="0" align="left" cellpadding="0" cellspacing="2" width="100%">
        <tr>
<!--MP3 player start -->
       <td align="left" width="33%">
         <?php
        if (tep_not_null($product_info['products_mp3'])) { 
        $titelename = $product_info['products_name'];
        $titelename = str_replace("'", "", $titelename);
    	 ?>
        <input type="button" value="<?php echo BUTTON_MP3 ?>" onclick="<?php echo 'javascript:popupWindow(\'' . 'player.php?track=' . $product_info['products_mp3'] . '&title=' . $titelename . '\') ';?>" class="submit" />
    	 <?php } ?>
       </td>
<!--MP3 player end -->
       <td align="center">
         <input type="button" value="<?php echo IMAGE_BUTTON_REVIEWS ?>" onclick="location='<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) ?>'" class="submit" />
       </td>
       
       <td align="right" width="33%">
         <?php
        if ($product_info['products_quantity'] > 0) {
          if ($product_info['products_master_status'] == 1) {
         echo tep_draw_hidden_field('products_id', $product_info['products_id']) . '<input type="submit" value="'.BUTTON_BUY_ALBUM.'" class="submit">';
       }
       else {
         echo tep_draw_hidden_field('products_id', $product_info['products_id']) . '<input type="submit" value="'.BUTTON_BUY_TITLE.'" class="submit">';
       }
        }
    	 ?>
       </td>
     </tr>
      </table>
      
  	 </td>
     </tr>
   </table>
    
    </td>
	 </tr> 	 
   </table>
   
 </td>
  </tr>
   </table>

<br />

<?php
  $master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . " ' and products_status = '1'");
  $results = tep_db_fetch_array($master_query);
  if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
    include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS);
  }
?>
</form>

<br />

<?php
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
?>

<br />

<?php
if (MAX_REVIEWS_IN_PRODUCT_INFO > 0) {
?>
<table border="0" width="100%">
  <tr class="even">
    <td><strong><?php echo TEXT_HEADER_CUSTOMERS_REVIEWS . ' (' . $reviews['count'] . ')';?></strong></td>
  </tr>
  <tr>
    <td>
 <?php
 $reviews_query = tep_db_query("select r.reviews_id, rd.reviews_text, r.reviews_rating, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and rd.reviews_id = r.reviews_id and rd.languages_id = '" . $languages_id . "' order by r.reviews_id DESC");
 $num_rows = tep_db_num_rows($reviews_query);
 ?>

   <table border="0" width="100%">
     <tr>
    <td align="left">
      <a href="<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo BUTTON_WRITE_REVIEW; ?></a> - 
     <a href="<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo BUTTON_MORE_REVIEWS; ?></a> - 
      <a href="<?php echo tep_href_link(FILENAME_TELL_A_FRIEND, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo IMAGE_BUTTON_TELL_A_FRIEND; ?></a>
    </td>
	 </tr>
	 
	 <?php
    $row = 0;
    while (($reviews_values = tep_db_fetch_array($reviews_query)) && ($row < MAX_REVIEWS_IN_PRODUCT_INFO)) {
      $row++;
   $date_added = tep_date_short($reviews_values['date_added']);
   if (($row/2) == floor($row/2)) {
     $class = 'class="even"';
   }
   else {
     $class = 'class="odd"';
   }
   ?>
   <tr>
     <td valign="top" align="left" <?php echo $class; ?>><?php echo sprintf(tep_image(DIR_WS_IMAGES . 'stars_' . $reviews_values['reviews_rating'] . '.gif')) . ' von <strong>' . $reviews_values['customers_name'] . '</strong> am ' . $date_added . '<br />' . htmlspecialchars($reviews_values['reviews_text']) ?></td>
   </tr>
   <?php
    }
	 ?>
   </table>
   
 </td>
  </tr>
</table>
<?php
}
?>

<br />

 </div>
 <?php
}
?>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

... with this code inside the product_info.php buying an downloading is no problem..

 

 

/*

 $Id: product_info.php 2003/07/01 14:34:54 hpdl Exp $

 

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com

 

 Copyright (c) 2003 osCommerce

 

 Released under the GNU General Public License

*/

<?php

 

 require('includes/application_top.php');

 

 

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 $product_check = tep_db_fetch_array($product_check_query);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="style.css">

<script language="javascript">

<!--

function popupWindow(url) {

 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=no,copyhistory=no,width=310,height=200,screenX=0,screenY=0,top=200,left=35

0')

}

//-->

</script>

 

</head>

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

 

<!-- header //-->

 

 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>

 

<!-- header_ende //-->

 

<!-- body //-->

 

<table border="0" width="75%" cellspacing="0" cellpadding="0">

 

 

 

 

 

 

 

<!-- body_text //-->

 

   <td valign="top" class="item">

  <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

   

 <table border="0" width="75%" cellspacing="0" cellpadding="0">

   <?php

     if ($product_check['total'] < 1) {

   ?>

 

     <td class="item">

 

    <table border="0" width="75%" cellspacing="5" cellpadding="0">

      <tr>

     <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellpadding="0" cellspacing="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td class="item">

 

    <table border="0" width="75%" cellspacing="5" cellpadding="0">

      <tr>

     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

     <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellspacing="0" cellpadding="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

<?php

 } else {

   $product_info_query = tep_db_query("select p.products_id, pd.products_name, p.products_spiel_dauer, p.products_release_datum, p.products_titel_anzahl, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

   $product_info = tep_db_fetch_array($product_info_query);

 

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

   } else {

     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

   }

 

   if (tep_not_null($product_info['products_model'])) {

     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

   } else {

     $products_name = $product_info['products_name'];

   }

?>

         <tr>

     <td valign="top" class="item">

 

    <table border="0" width="75%" cellspacing="10" cellpadding="0" class="item">

      <tr>

     <td align="left" valign="top" class="wt_ueberschrift"><?php echo $products_name; ?></td>

     <td align="right" valign="top" class="wt_ueberschrift"><?php echo $products_price; ?></td>

   </tr>

   <tr>

     <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

   </tr>

   <tr>

     <td align="left" valign="top" class="item">

       <?php echo sprintf(TEXT_PRODUCTS_LABEL, ($product_info['manufacturers_name'])); ?><br>

    <?php echo sprintf(TEXT_PRODUCTS_SPIEL_DAUER, ($product_info['products_spiel_dauer'])); ?><br>

     </td>

     <td align="right" valign="top">

       <?php

      if (tep_not_null($product_info['products_image'])) {

    ?>

   

      <table cellspacing="0" cellpadding="0" border="0">

        <tr>

       <td align="right" valign="top">

         <?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>

       </td>

     </tr>

       </table>

     

    <?php

    }

    ?>

     </td>

   </tr>

   

    </table>

   

  </td>

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellpadding="0" cellspacing="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td class="item">

 

    <table width="75%" border="0" cellpadding="0" cellspacing="20">

      <tr>

     <td align="left" valign="top" class="item">

       <p><?php echo stripslashes($product_info['products_description']); ?></p>

    <?php

      $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

      $products_attributes = tep_db_fetch_array($products_attributes_query);

      if ($products_attributes['total'] > 0) {

    ?>

   

    <table border="0" cellspacing="0" cellpadding="0">

      <tr>

        <td valign="top" align="left" class="item" colspan="3">

       <?php echo TEXT_PRODUCT_OPTIONS; ?>

     </td>

      </tr>

     

        <?php

       $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

       while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

         $products_options_array = array();

         $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

         while ($products_options = tep_db_fetch_array($products_options_query)) {

           $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

           if ($products_options['options_values_price'] != '0') {

             $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

        }

      }

      if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

      $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

       }

       else {

      $selected_attribute = false;

       }

     ?>

      <tr>

        <td valign="top" align="left" class="item" colspan="3">     </td>

      </tr>

     <tr>

        <td valign="top" align="left" class="item"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

     <td valign="top" align="left" class="item">     </td>

     <td valign="top" align="left" class="item"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, ' class="item" '); ?></td>

         </tr>

        <?php

     }

     ?>

    </table>

       <?php

    }

    ?>

     </td>

   </tr>

     <?php

     if (tep_not_null($product_info['products_url'])) {

     ?>

   <tr>

     <td class="item"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

         </tr>

     <?php

     }

     ?>

    </table>

   

  </td>

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellpadding="0" cellspacing="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td class="item">

 

    <table width="75%" cellspacing="0" cellpadding="0" border="0">

      <tr>

     <td>

     

       <table width="75%" cellspacing="15" cellpadding="0" border="0">

      <tr>

        <td width="33%" align="center" valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

     <td align="center" valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>

     <td width="33%" align="center" valign="middle"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

      </tr>

    </table>

   

     </td>

   </tr>

    </table>

   

  </td>

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellpadding="0" cellspacing="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

   

     <?php

  $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

  $reviews = tep_db_fetch_array($reviews_query);  

  if ($reviews['count'] > 0) {

  ?>

   <tr>

     <td class="item">

 

    <table width="75%" cellspacing="5" cellpadding="0" border="0">

      <tr>

     <td align="left" valign="middle" class="item"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>

   </tr>

    </table>

   

  </td>      

   </tr>

   <tr>

     <td>

 

    <table width="75%" border="0" cellpadding="0" cellspacing="0" class="wt_bodyhg">

      <tr>

     <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>

   </tr>

    </table>

   

  </td>

   </tr>

     <?php

  }

  if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {

  ?>

   <tr>

     <td class="item">

 

    <table width="75%" cellspacing="5" cellpadding="0" border="0">

      <tr>

     <td align="center" valign="middle" class="item"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>

   </tr>

    </table>

   

  </td>      

   </tr>

     <?php

  } else {

  ?>

   <tr>

     <td class="item">

 

    <table width="75%" cellspacing="5" cellpadding="0" border="0">

      <tr>

     <td align="center" class="item"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>

   </tr>

    </table>

   

  </td>      

   </tr>

     <?php

  }

  ?>

   <tr>

     <td>

 

   

   

  </td>

   </tr>

   <tr>

     <td class="item">

    <?php

      if ((USE_CACHE == 'true') && empty($SID)) {

   echo tep_cache_also_purchased(3600);

   } else {

   include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);

   }

   }

    ?>

  </td>

   </tr>

   <tr>

     <td>

 

   

   

  </td>

   </tr>

 </table>

 

 </form>

 

   </td>

 

<!-- body_text_ende //-->

 

 

 

 

 

 </tr>

</table>

 

********************************************************************************

*************

 

<?php

 // Master Products EOF

 if ($product_check['total'] < 1) {

 ?>

 

 <div class="itemInfo">

   <table width='100%'>

  <tr>

    <td align='left'><b>   </b></td>

  </tr>

</table>

 </div>

 

 <div class="itemBody">

   

<br />

 

<?php include(DIR_WS_MODULES . FILENAME_NAVI_CATEGORIES); ?>

 

<br />

 

   <table border="0" width="100%" cellspacing="0" cellpadding="2">

  <tr>

    <td align="center"><strong><?php echo TEXT_PRODUCT_NOT_FOUND; ?></strong></td>

  </tr>

</table>

 

<br />

 

   <table border="0" width="100%" cellspacing="0" cellpadding="2">

  <tr>

    <td align="center"><input type="button" value="<?php echo BUTTON_CONTINUE ?>" onclick="location='<?php echo tep_href_link(FILENAME_DEFAULT) ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×