获取选择选项而不是不同的按钮php类

时间:2017-02-24 12:17:03

标签: php html

我试图在产品的不同尺寸之间进行选择。我制作了一个脚本,它回显了各种尺寸的按钮,但我怎么能用选择的形式呢?

在DB中,产品有一个主人,每个尺寸都是一个选项。

使用($_GET['add'])获取产品,以便在购物车页面上获取产品。 在最后一次我给wagen.html?add='.$s['id'],所以我可以在购物车中使用该ID。

class ProductDisplay {

    public function display($content){
        global $db, $properties, $cms, $adb;
        $content = unserialize($content);

        $itm = $adb->queryrow("SELECT * FROM products WHERE id=? LIMIT 1", array(intval($content['wlpid'])));
        $vat = $adb->querykeyvalues("SELECT id, multiplier FROM tax");
        $prijs = (($itm['price']*($vat[$itm['tax']]/100))/100);

        $subs = $adb->queryarray("SELECT *, (SELECT value FROM propertyvarchar WHERE lang=1 AND propid=1 AND product=p.id lIMIT 1) as name, (SELECT value FROM propertyvarchar WHERE lang=1 AND propid=5 AND product=p.id lIMIT 1) as opt FROM products p WHERE master=?", array($itm['id']));

        echo '
        <div id="the_product_container" class="para_container"></div>
        <div id="anchor_1_product"></div>
        <div id="anchor_2_product"></div>
        <div id="anchor_3_product"></div>
        <div id="page_product" class="anchor_pos"></div>
        <div id="page_product_check" class="anchor_check"></div>

        <div class="bonds">
            <div class="scaleme">
                <img alt="shirt" class="content" src="/uploaded/overige/'.$content['main'].'">';
                $ar = array(
                    1=>"point_one",
                    2=>"point_two",
                    3=>"point_tree",
                    4=>"point_four",
                    5=>"point_five",
                );
                for($i=1; $i<=3; $i++)
                {
                    if(!empty($content['info'.$i]))
                        echo '<img alt="Product point" id="'.$ar[$i].'" class="'.$ar[$i].'" src="/uploaded/overige/'.$content['info'.$i].'">';
                }

            echo '</div>
        </div>
        <div class="mobiel_text_con">';
            for($i=1; $i<=3; $i++)
            {
                if(!empty($content['info'.$i]))
                    echo '<div class="text_block">
                        <h3>'.$content['info'.$i.'h'].'</h3>
                        <hr />
                        <p>
                            '.$content['info'.$i.'t'].'
                        </p>
                    </div>';
            }
        echo '</div>';

        if(empty($subs))
        {
            echo '<div class="pricetag">
              <p>'.number_format($prijs,2,',','.').' &euro;</p>
            </div>
            <div class="button_holder_ordernow">
                <a title="Order Now" href="/winkelwagen.html?add='.$itm['id'].'" class="sumbit_button">order now</a>
            </div>
            <div class="photo_overlay_filter2"></div>';
        }
        else
        {
            echo '<div style="display:inline-block; text-align:center; width:100%;">
                <div class="pricetag">
                  <p>'.$itm['name'].' ('.$itm['opt'].') '.number_format($prijs,2,',','.').' &euro;</p>
                </div>
                <div style="display:inline-block;">
                    <div class="button_holder_ordernow" style=" padding-bottom:20px;">
                        <a title="Order Now" href="/winkelwagen.html?add='.$itm['id'].'" class="sumbit_button">order now</a>
                    </div>
                </div>
            </div>
            <div class="photo_overlay_filter2"></div>';
            foreach($subs as $s)
            {
                $prijs = (($s['fromprice']*($vat[$s['tax']]/100))/100);
                echo '<div style="display:inline-block; text-align:center; width:100%;">
                    <div class="pricetag">
                      <p>'.$itm['name'].' ('.$s['opt'].') '.number_format($prijs,2,',','.').' &euro;</p>
                    </div>
                    <div style="display:inline-block;">

                        <div class="button_holder_ordernow" style=" padding-bottom:20px;">
                            <a title="Order Now" href="/winkelwagen.html?add='.$s['id'].'" class="sumbit_button">order now</a>
                        </div>
                    </div>
                </div>
                <div class="photo_overlay_filter2"></div>';
            }
            echo '<br /><br /><br /><br />';
        }

    }

}


?>

0 个答案:

没有答案