<?php
class ControllerToolPriceChange extends Controller{

    public function index()
    {

        die();

        /*
         *  şeffaf koleksyion -> şeffaf -> 29.576271186440678 //197 - 262  -- 40290
            neon koleksyiyon -> violet -> 50 // 189 - 190 --- 12912
            neon koleksyiyon -> green -> 50  // 189,191   ---- 12912
            neon koleksyiyon -> turuncu -> 50  // 189,192  --- 12912

            aqua koleksyiyon -> siyah -> 37.28813559322034  // 193,195
            aqua koleksyiyon -> pembe -> 37.28813559322034  // 193,194
            aqua koleksyiyon -> gri -> 37.28813559322034   // 193,196

            renkli slikon -> siyah -> 33.05084745762712  // 199,200
            renkli slikon -> kırmızı -> 33.05084745762712  // 199,201
            renkli slikon -> pembe -> 33.05084745762712   // 199,202
            renkli slikon -> sarı -> 33.05084745762712   // 199,203

            Glossy-> popsoketli -> 37.28813559322034   // 253,277
            Glossy-> popsoketsiz -> 33.05084745762712  // 253,276
            Glossy-> şeffaf ->  -> 33.05084745762712  // 253,263

         */



        $price = 33.05084745762712;
        $products = $this->db->query("SELECT p.product_id FROM ps_product p 
        LEFT JOIN ps_product_attribute pa ON (p.product_id = pa.product_id) WHERE pa.attribute_id IN (253,263) GROUP BY p.product_id ")->rows;

        $count = 0;
        foreach ($products as $product){
            $this->db->query("UPDATE ps_product SET price = '". $price ."' WHERE product_id = '". $product['product_id'] ."' ");
            $count++;
        }
        echo $count;

    }

}