ljh23 Posted July 18, 2005 Share Posted July 18, 2005 I would like to find out if the Master Products contribution and Listing with Attributes and Qty can be used together. I would love to be able to add my attributes on the page where I add my product. I have not been working with code for very long, therefor I cannot figure it out for myself. So if anyone has these working together (if it is possible) I would love to know what adjustments I need to do! If there is anyone who hasn't attempted to do this, but would like to put their input in, here is the code where I am having a conflict... My current code with Master Products installed case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; //Master Products if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') { $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; } elseif ($listing['products_master'] != '0') { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; } //Master Products EOF break; Code from Listing with Attributes Contribution look for: case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> '; break; replace with: // Begin Buy Now button with attributes and quantity mod case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<form name="buy_now_' . $listing['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now_form', 'NONSSL') . '">'; $lc_text .= '<input type="text" name="cart_quantity" value="1" maxlength="6" size="4">'; $lc_text .= '<input type="hidden" name="products_id" value="' . $listing['products_id'] . '">' . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . ' '; $product_info_query = tep_db_query("select p.products_id, pd.products_name, 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, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $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='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected = 0; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $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 = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $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'])) .') '; } } $lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; } $lc_text .= '</form>'; break; // End Buy Now button mod // Begin Add Multiple with attributes Contrib case 'PRODUCT_LIST_MULTIPLE': $lc_align = 'right'; $lc_valign = 'top'; $lc_text = 'Qty: <input type="text" name="Qty_ProdId_' . $listing['products_id'] . '" value="0" maxlength="6" size="4">'; $product_info_query = tep_db_query("select p.products_id, pd.products_name, 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, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $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='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected = 0; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $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 = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $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'])) .') '; } } $lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; } break; // End Add Multiple mod Quote Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2005 Share Posted July 18, 2005 There is an attributes contribution available where the main Master Products download is. Matti Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.