Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter

[eluser]Matthew Diggins[/eluser]
Hi again,

I've been using Flexi cart with PayPal WPS and am using Instant payment Notification (IPN) to update orders once the payment has occurred. I'd like to use this opportunity to empty or destroy the user cart. Of course, the IPN callback is not the user session, so can I use the cart id to do this? There doesn't seem to be a method of using the cart id for this purpose? It's easy enough to include the id in the custom field that IPN returns. Otherwise, the cart is left to expire - or - if the user returns to the site from PayPal, it can be emptied then, but only if they return to the "success" url (or perhaps something more complicated to empty it from any site page).

By the way - very impressed with Flexi cart!

[eluser]haseydesign[/eluser]
@Matthew Diggins

Good to hear your liking flexi cart!
Regarding your question, I've not used PayPal WPS before so I'm a little unsure of what you're exactly trying to do.

I'm presuming you're sending a set of data off to PayPal, which then in turn returns data to your application which you then wish to use to confirm whether your payment transaction has been successful.
Within the data that you send to PayPal, you wish to send an order identifier which will then be sent back to you to identify the order that the transaction corresponds to.
Is my understanding correct?

If so, then yes you could use the cart id via cart_data_id(), but why not use the auto generated order number instead? - order_number()
The cart id is not automatically associated with the completed order, whilst the order number is, meaning you can link the transaction with the order much easier.

[eluser]koichirose[/eluser]
Hello again haseydesign Smile

Is there a way to apply a discount to a single product in the cart?

I'm building an advanced discount system, I'd like to be able to apply a 10% discount (for example) only to products of brand XXX or other filters (price > y, 'shoes' category, etc.).

Thank you again!

[eluser]haseydesign[/eluser]
@koichirose

To add discounts to single items, checkout the demo @ http://haseydesign.com/flexi-cart/admin_..._discounts
This allows you to define the same discount settings as with the summary, but for a specific item defined via the 'Apply discount to item' select menu on http://haseydesign.com/flexi-cart/admin_...t_discount.

To add discounts to groups of multiple items, checkout http://haseydesign.com/flexi-cart/admin_...unt_groups
This allows you to create a group of items that you have filtered using a set of custom filters.
You can the apply the discount to that item group via the 'Apply discount to group' select menu on http://haseydesign.com/flexi-cart/admin_...t_discount

[eluser]koichirose[/eluser]
@haseydesign

Thank you.
Using custom statuses is kind of hard for me, so I made my own discount conditions.
Tell me if I'm wrong, but having custom conditions can't be done with flexi-cart, correct?
I mean something like "product brand is XXX", "product price is > 50" etc.
I think we talked about this already but I'm not sure Smile

What I'd need is a function that allows me to apply a discount to a row_id.

This way, I'll verify which conditions apply to each product and apply the discount on the single item.

Is that possible?

Right now, I'm simply calculating the discount myself and updating the product price (while also saving a 'non_discounted_price' to keep the original price).
This may be good enough for me (I'm testing it now), but I was wondering if you had smarter suggestions Smile

[eluser]haseydesign[/eluser]
@koichirose

Hey again, I'm also pretty sure we touched on this topic before sometime, but here's the low-down again.

When designing the library, I needed it to be flexible enough to work for many users different database setup regarding product/item tables. Whereas it would have been easy for me to include a product_category and product_brand column within the libraries discount table - that wouldn't have helped users that has a slightly different database setup that wanted to target product_sub_categories.

Therefore, I added the 'discount_group' and 'discount_item_group' tables. These tables allow you to group a set of items, which can then be targeted by discounts via using the 'disc_group_fk' column within the main discount table.

How you add items to your discount group is up to you, however, in the demo, I included an working example (http://haseydesign.com/flexi-cart/admin_...up_items/1) where you can select items via their name, category, price etc, and then add ALL of the matched items to a group via just one page and one html form.

This demo can easily be expanded to match items to whatever product/item attributes you are trying to match - all without needing to clutter the main discount table with product/item attribute columns.

So checkout the above link, look through the associated demo controller, model and view files - and you should be able to achieve what you want to do.

The particular demo files you'll need to look at are:
- \models\demo_insert_discount_group.php
- \views\demo\admin_examples\discounts\discount_group_items_insert_view.php

If you still want to go your own route on a per item discount, then you can match an item id to the discount table via the 'disc_item_fk' column.


[eluser]koichirose[/eluser]
@haseydesign, thank you as always Smile
I'll see what I manage to do with discounts, somehow I'll solve my issue Smile

I'm now thinking about rewards (just thinking for now):
I see that flexi-cart saves rewards for each order, then to get the total points for a user it joins the right tables.

I would like to reward users with points for certain actions (registered, commented somewhere, etc).
To do this I'd use my own tables and then manually calculate the discount (ex. 500 points = 5€) and apply it with flexi-cart.

I wouldn't use flexi reward functions at all.

Do you think there would be a better solution to do this?

Thank you

[eluser]haseydesign[/eluser]
@koichirose

Your solution sounds like it would work okay, you may just want to close a few loopholes that users can exploit.

For example, the flexi cart reward points feature can protect the store from issuing reward points for purchases made by customers, to which the customer then returns the item for a refund, but has still earned the reward points.

The library does this by allowing a storewide return policy time period to be defined, reward points are then only issued to customers that do not return items within this time period.

Hope that helps


[eluser]jairoh_[/eluser]
does this include payplal ipn?

[eluser]haseydesign[/eluser]
@jairoh_

No, flexi cart does not come with any out-of-the-box integrations to payment gateways; a custom solution is required.

You could try looking at combining http://ci-merchant.org/ with the flexi cart library.




Theme © iAndrew 2016 - Forum software by © MyBB