Product Price Change per Attribute Choices
$40 USD
Slået op over 12 år siden
$40 USD
Betales ved levering
Implement the attached file using this function...
function getPrice(price,product_id,attr_arr)
{
opt_id = [login to view URL]("optionsid").value;
xmlHttpObj = getxmlHttpObj();
xmlHttpObj.onreadystatechange=function()
{
if(xmlHttpObj.readyState==4)
{
[login to view URL]("display_price").innerHTML = [login to view URL];
}
}
[login to view URL]("GET","[login to view URL]"+price+"&option_id="+opt_id+"&product_id="+product_id+"&product_opt="+attr_arr,true);
[login to view URL]();
}
and follow this code as a guide to make the dropdowns in the attached [login to view URL] work this way.
<?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) {
?>
<p>
<?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");
$numberofopt = tep_db_num_rows($products_options_name_query);
$opt_count = 0;
$products_attributes = array();
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
array_push($products_attributes,$products_options_name['products_options_id']);
$opt_count++;
$products_options_array = array();
//<!-- AJAX Attribute Manager -->
$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.products_options_sort_order");
//<!-- AJAX Attribute Manager end -->
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 (is_string($HTTP_GET_VARS['products_id']) && 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;
}
?>
<b><?php echo $products_options_name['products_options_name'] . ':'; ?></b> <?php
$comma = "";
$all_option_js = "[";
for($t = 1;$t<=$numberofopt; $t++)
Projekt-ID: 1270466
Om projektet
1 forslag
Projekt på afstand
Aktiv 12 år siden
Leder du efter muligheder for at tjene penge?
Fordele ved budafgivning på Freelancer
Fastsæt dit budget og din tidsramme
Bliv betalt for dit arbejde
Det er gratis at skrive sig op og byde på jobs