We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38278
    • 1 Posts
    design studio Reply #1, 14 years ago
    Hello I have this coding for Price change. I wanted to tag an attribute values to an attribute value from MySql but i dont know what i have to do can anybody help me? here is the coding below. I tag my attribute to the product and attribute value to the attribute.
    Example --> Let say Food is the product: When food is selected you have attribute of Drinks, Snacks, Meals, Desserts, Meals Special
    Food --> Meals (under meal you can select) |--> Brakfast, Lunch, Dinner
    Special Meals (this will change to the right corresponding based on Meals selections) --> $5 breakfast or $2 Lunch or $10 Dinner

    Question is how do i get the Special meal attribute values to only respond when the right selection is made on Meals options?


    <?php
    $sql_atr = "SELECT * FROM product_attributes WHERE product_id = ".$row_prod['id'].' and published=1';
    $exe_atr = mysql_query($sql_atr);
    $price = 0.00;
    $price1 = $_SESSION['price'];
    $qty = 0;

    ?>
    <div class="rightarea">
    <div class="formcontainer">
    <div class="selectopt"></div>
    <div class="middle">
    <form name="searchatrb" id="searchatrb" action="process.php?action=cart" method="post" enctype="multipart/form-data">
    <?php
    $printstr = '';
    while($row_atr = mysql_fetch_assoc($exe_atr)){
    $atrname = $row_atr['name'];
    ?>
    <div class="title">
    <?php echo $atrname;?>
    <div class="help"><!--<img src="images/help.jpg" />--></div>
    </div>
    <div class="fields">
    <select onchange="changePrice(this.value, this)" name="<?php echo $atrname;?>" id="<?php echo $row_atr['id'];?>" class="fields">
    <?php

    $sql_atrv = "SELECT * FROM prod_attrbt_values WHERE att_id=".$row_atr['id'];
    $exe_atrv = mysql_query($sql_atrv);
    $atr_cnt = 0;
    while($row_atrv = mysql_fetch_assoc($exe_atrv)){
    $atrprice = $row_atrv['price'];
    if($row_atr["name"] == "Quantity"){
    if($atr_cnt == 0){
    $qty = $row_atrv['name'];
    }
    $atrprice = $row_atrv['name'];
    }
    ?> [ed. note: design studio last edited this post 14 years ago.]