Drupal, UberCart – How to return / get back the cart from database
I’ve tried to found the solution how to revert the cart that is already in the database but as always I didn’t found any good solution though. I was looking the files which can help me to regenerate it and finally I’ve found it! Below you got the code that get any cart from the db and populate it.
1 2 3 4 5 6 7 8 9 10 |
function revertCart($cartId) { $items = uc_cart_get_contents($cartId, 'rebuild'); if (! empty($items)) { foreach ($items as $item) { uc_cart_add_item($item->nid, $item->qty, $item->data); } } } // revertCart('the ID from uc_cart_products |
Enjoy!
How to Change the Original Price in Prestashop
That’s a really useful snipet for anybody who wants to change the original price to the new one.
Solution for this is very easy …
Ok .. here it is:
Product.php, line 1686
1 2 3 4 5 6 |
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, $with_ecotax = TRUE) { // .... find some space before `return` $my_new_price = Warehouse::getPriceByDay(); return $my_new_price; |
Hello World in 2011!
Finally I decided to start blogging. I will be creating posts about making software and in the first order I will be writing about creating software by using PHP. But in the future a want to learn something more about JAVA for mobile and I think it will be a great subject to writing and I suppose it may be interested.