shopping-cart

Add a CSS class to an item when Woocommerce cart is empty

删除回忆录丶 提交于 2019-12-06 06:39:22
I am trying to hide my cart when it is empty, so I decided to add a CSS class to the cart HTML item when the cart is empty, here is my current code: function x_woocommerce_navbar_menu_item( $items, $args ) { if (WC()->cart->cart_contents_count == 0 ) { echo '<script type="text/javascript"> $(document).ready(function() { $("#header_cart").addClass("zero"); }); </script>'; } I am adding this to my functionts.php file Am I missing anything? It will be good if you add the class to body to make the hierarchy in CSS. Use the following code in functions.php : function tristup_body_classes( $classes )

Prevent script from re-executing action on page refresh

﹥>﹥吖頭↗ 提交于 2019-12-06 05:12:13
问题 I am building my own php cart for the past week and I got stuck in some issues. I managed to add new items in the cart, and the URL looks like below. http://blah-blah.com/order/index.php?action=add&id=84 The question is simple: How can I prevent from adding the same item again in the cart if someone refreshes the page? Cause now every time someone refreshes the page, it changes the quantity to +1 for the specific item.. Also, after moving to the checkout page, if they press the back button in

Shopping cart and different kinds of discounts. Storing discounts in DB and applying it to order calculations

ぃ、小莉子 提交于 2019-12-06 02:34:32
Currently, I'm looking for best practice to "applying discounts" to cart/order. So, I'm planning to implement such kind of discounts as... fixed user's discount (for example, I'd like to give 10% discount to my favourite customer) discount for number of items (for example, you're buying 10 different colored pens and you'll be getting discount of 1.5%) discount for coupon (for example, during promo action we've produced 100 coupons with 10% discount each. Coupons work only for one order and expire on yyyy-mm-dd) present for purchasing item or group of items (for example, you're buying pen, list

Change display order of checkout buttons in Magento

非 Y 不嫁゛ 提交于 2019-12-05 16:09:41
I need to place checkout buttons in shopping cart page in order 1) Proceed to checkout 2) Google checkout 3) Paypal Express checkout.xml inside <checkout_cart_index> <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label"> <label>Payment Methods After Checkout Button</label> <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" as="testproceed" after="-" template="checkout/onepage/link.phtml"/> <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/> </block>

Magento New Cart Attribute

≯℡__Kan透↙ 提交于 2019-12-05 12:42:25
Hi well the problem I am facing seemed to be very simple at first but turned into a real nightmare now. I was asked to add an attribute (namely point) to all the products (which was done pretty simple using the admin panel) and have its total as a cart attribute which rules can be set upon!? I am quite positive that cart attributes are defined in: class Mage_SalesRule_Model_Rule_Condition_Address extends Mage_Rule_Model_Condition_Abstract { public function loadAttributeOptions() { $attributes = array( 'base_subtotal' => Mage::helper('salesrule')->__('Subtotal'), 'total_qty' => Mage::helper(

Anybody ever used PayPal Website Payments Standard with SESSION variables?

跟風遠走 提交于 2019-12-04 21:25:47
Note: Our site is built in PHP and uses MySQL databases. I already manage another site with shopping cart in its entirety using Authorize.net so please dont respond with suggestions to use another provider. A new product/service we are releasing is classified as "High Risk" to the merchant providers and they want to charge us out the a**. In response, I figured setting up a Website Payments Standard account on Paypal.com was the best alternative for the following reasons: 1) no monthly charges, only pay for what is used 2) trust brand and people are comfortable with Paypal The rates are quite

Persisting a shopping cart in Ruby on Rails

╄→尐↘猪︶ㄣ 提交于 2019-12-04 21:19:58
问题 Currently developing a shopping cart, the options for persisting the cart, as i see them are: Store the entire cart object in a sessions table. Store the entire cart object in a cookie session. Have a cart table, and store the cart id in a cookie session. Have i missed any? which is the best to roll with please? Thanks 回答1: #3 is probably your best bet, because that gives you the most freedom/flexibility. Say someday you want users to be able to save their shopping carts between sessions. Or

Transferring order values from php shopping cart to MySQL

雨燕双飞 提交于 2019-12-04 20:48:01
I am trying to setup a “checkout/order” page within a site in which logged in users earn points/credits. Once they earn a certain amount of these points they can then go to a shopping cart and pay with these points only. (No money changes hands, so no paypal/checkout/shipping/taxes etc are involved). I have done a 'shopping cart' page and 'view cart' page (view cart code is on this page ), which works fine thanks to Steve and KMK ;). I have two tables on my MySQL database, 'orders' (which has order id, users id, total & time stamp) and 'order_contents' (order contents id, order id, product id,

Paypal Express Checkout: Mixed Recurring and Non-Recurring Items

£可爱£侵袭症+ 提交于 2019-12-04 16:56:09
I am working on our company cart which contains products that people can either subscribe to or just buy outright. The problem is that it should require customers to add both types in a single order. Question: It is possible to to tell Paypal to charge selected items as subscription and the others as one-time payments? Thanks in advance. According to the advanced features documentation page 47/48, this is possible by calling SetExpressCheckout with the recurring products as BillingAgreements and the other products as normal, then calling DoExpressCheckoutPayment if there are one-time payments

How to remove the single cart item using codeigniter cart class?

萝らか妹 提交于 2019-12-04 13:55:43
I am using codeigniter cart class for my shopping cart project. I have number of items on the cart. Now I do have cart row id. Now what exactly i need to do is, need to remove the particular item from the cart not all the contents(Destroying cart). $cartcontents = $this->cart->product_options($rowid); and unseting all contents. but doesn't works out. Please do help you anybody have an idea. Thank You. $data = array( 'rowid' => '30ef30b64204a3088a26bc2e6ecf7602', 'qty' => 0 ); $this->cart->update($data); use this Use "removeCartItem" function in your controller to do this... function