irl Posted January 17, 2011 Share Posted January 17, 2011 Hello,Would anybody know, how to increase prices (bulk %) in a selected Category all its subcategories and productsI made a function in classes/products.phppublic function categoryName($id_category) { $sql ='SELECT `name` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` = '.intval($id_category); $result = Db::getInstance()->getRow($sql); return $result['name']; }I am trying to get:if ($Category = Product::categoryName($Product['id_category_default']) {... selected categories A, B, C ...$Price = Product::getPriceStatic(intval($Product['id_product']))*1.25; }elseif ($Category = Product::categoryName($Product['id_category_default'])){$Price = Product::getPriceStatic(intval($Product['id_product'])); }Above would increase all prices in all categories.Can anybody help? Thank you Link to comment Share on other sites More sharing options...
irl Posted January 18, 2011 Author Share Posted January 18, 2011 Nobody ?!?Should be somebody with PHP knowledge on this forumMay be useful for others if have affiliates which would pull products and prices from your site. Link to comment Share on other sites More sharing options...
irl Posted January 18, 2011 Author Share Posted January 18, 2011 Php for me is like salt in my eyesSpent >3 hours and still cannot get it workWorks in asp flawless however in php "if" returns false alwaysChanged to strcmp returns true always$itemarr = array( 'blam a', 'blam b'); foreach ($Products AS $Product) { if ($Product['active'] and $Product['price']!=0) { $Price = Product::getPriceStatic(floatval($Product['id_product'])); $Category = Product::categoryName($Product['id_category_default']); foreach ($itemarr AS $myarr){ If((string)$myarr == (string)$Category) $Price *= 1.25; }Any idea why? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now