Post by Hashishim » Sat Aug 20, 2011 10:41 pm

I do not mind paying for someone to do this for me, or even guide me towards it

I plan to purchase the mygate module and the payfast module. I am from South Africa, so the above modules would be okay for me.

Anyways what i want to do with the site, i currently made alot of modifications to it and it is all working perfectly there is just one that i am having trouble with, I am fairly knowledgable in php and html.

Unfortunately this has really stumped me even though i do know that the answer is infront of me. I have done a bit of the framework and created an idea of implementing it i will mention it below. And I first apologize if i may go to much in detail here, but feel it is necessary.

My online store mainly sells/retails PS3 Gaming Titles and other Console Games. What i require specifically here is with regards for Pre Orders.

I want to allow my customers to Pre Order the game by just paying a deposit of ZAR 100.00 . And to pay for the remaining one week before release or whenever they wish ( I will notify them manually prior to the last day of that week)

I already made a framework and an Idea of how to get it working, using the resources that I had. I first created 2 Fields on the product database. called:

depositamnt: Shows the Deposit amount Customer needs to pay e.g. 100.00

balancepay: Shows the Balance amount customer has to pay after deposit e.g. 395.00

This bit shows perfectly on the catalog and on the product pages on the back-end and front-end. And it only appears on the front end when one of the fields is active and pre order is active

The issue I am having is got to do with the actual payment.
I will explain to you what I would like to happen and after that I will tell you what I have done so far. For explanation purposes I would use an example of a product being FIFA 12. Price is ZAR 495.00 and the DEPOSIT amount is ZAR 100.00

Here is what I would like to happen and to do:
I would like my customers when they add 'FIFA 12' to the cart to go through the normal process and choose one of the 3 payment gateways this being:
MyGate; PayFast; or Standard Bank Transfer With our banking details.

I would like it to when they wish to purchase it as a preorder to pay a deposit which is required to guarantee/confirm their order. The deposit amount being "100.00" and using the field "depositamnt" as this is where the amount is actually stored as different products will have different deposit amounts.

Now when it comes to payment of it after selecting the payment options and clicking confirm. I would like the payment METHODS Gateway to take the 'depositamnt' field or "100.00" as the amount needed to pay. And not the Total Amount (which includes TAX) this being ZAR 495.00

The ZAR 100.00 should be shown for PayFast Gateway, MYGate Gateway and in the Banking Account Details box for the Bank Transfer Method

And a small little comment should be shown below this just before the confirm order button. Mentioning that you will be notified via email on how to make full payment (I will explain how I intend to accomplish this later)

Once payment is done on their order via their Order History in the Front-End and on a seperate line it should show The Deposit as being paid and deducted from the Full Price of the title with the remaining balance (taken from the balancepay field) that is due.

This should also reflect on the invoice being created via the back-end. When the time for delivery I will print it and stamp it saying paid fully so no need to edit this part further

But on the back-end by sales/orders it should also show on a separate line the Deposit Amount; The Full Price; and the Remaining Balance that is due.

Please note the Balance Amount can be taken from the field "balancepay" (as this balance will not change and remain static which will make the task of implementing this easier)

And when payment is done I can simply just add a note/comment on the order saying Paid in Full etc this can be done using the normal method of adding a comment.

Now here is the harder part for me which I am trying to figure out. Is allowing the customers to pay the remaining balance using the PayFast Gateway and the MyGate Gateway. With regards to the Bank Transfer that is simple just plain text on a page or email to make it more professional i will do both.

I had an idea of doing this.

On the Customers Account Section
Create a Link that goes to Sub section by My Orders, Called for e.g. Pay Now or Outstanding Order Payments.

When they go to this link, What should show is a list of the available Pre Orders that the customer has made a deposit of and that is pending full payment or has made full payment ( In order for this list not to show all purchases non-preorders as well this list should be controlled/populated only when the "depositamnt" field from the product database is active or set for each product)

This list should show Just the Order ID's and the Product Name with the Release Date (I have already created a field for that aswell it is called release_date)

When they click on it it should show the full order with the following fields:

Order ID Number; Product Name; Full Price; Balance Owing.

Below that should include the 2 Pay now Buttons that i got from the PayFast Gateway and MYGate Gateway which is a simpler html gateway and not fully intergrated but perfect for this section/task. and next to it a small Box showing method to pay via standard bank transfer with banking details etc. As well as an box to let them know if they in the city of our store that they can do pick up and pay then.

The Coding for the PayFast Pay Now Button is this:

Code: Select all

<?php echo $payment; ?><form action="https://www.payfast.co.za/eng/process" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="joosub@kamjo.co.za">
<input type="hidden" name="item_name" value="<?php echo 'Pre Order Deposit'; ?><?php echo $product['name']; ?> <?php echo $order_id; ?> <input type="hidden" name="item_description" value="<?php echo 'For User Email Address'; ?> <?php echo $email; ?> <?php echo 'For First Name and Last Name'; ?> 

<?php echo $account[firstname]; ?><?php echo $account[lastname]; ?>">
<input name="amount" size"7" />
<input type="hidden" name="return_url" value="LINK TO THE SAME ACCOUNT SUB PAGE">
<input type="hidden" name="cancel_url" value="LINK TO THE SAME ACCOUNT SUB PAGE">
<input type="image" src="http://www.payfast.co.za/images/buttons/buynow_basic_logo.gif" width="95" height="57" alt="Buy Now" title="Buy Now with PayFast">
</form>
The MyGate Pay Now Button code is similiar.

The data should be drawn from the Database of the order, and the customer details, the amount will be typed in by the Customer if it is possible to create the amount field to show just the balance owing amount and be hidden that will be better as that was the button standard way was hidden.

From there onwards it is done.

It may seem complicated but i Do know it is possible and a system that can work. What I Have done so far is up to the point of creating the order and choosing payment methods, But I am unsure how to force the payment methods to choose the Depositamnt field instead of the total full price amount when the product is a pre order Item. But for when it is normal non pre order it should use the normal system.

When I tried to make the controller file of the banktransfer (as an experiment) to get the above mentioned fields from the database i got a jsonparse error after i select payment method to go to the confirm button. And I have been sitting for 48hours trying to figure it out but I cannot.

Once i got access to making controller call the database fields from their respective tables. I could easily edit the .tpl of the respective payment methods to use the if else statements on when to use Total Amount Field or the Depositamnt Field if the depositamnt is set.

Guidance would be appreciated on editing the proper interrgation modules(ie your payfast module and Mygate Module) php files and tpl files so i dont make silly mistakes.

And in terms of the other steps it would be the same of simply the controller retrieving the fields from its databases and models. Which is something i can do myself with a bit of guidance if possible.

I am sorry if this may seem a complicated task, but i also feel this could be useful for other OpenCart users and would be an excellent feature to include.

New member

Posts

Joined
Mon Jul 25, 2011 5:44 am

Post by Hashishim » Fri Aug 26, 2011 10:10 am

This is solved:) Managed to implement it!

New member

Posts

Joined
Mon Jul 25, 2011 5:44 am

Post by makingtrails » Tue Dec 13, 2011 1:15 am

Hey,

Would you mind documenting the solution!? I too would like to accept pre-orders based upon a small deposit

Thanks

J

User avatar
New member

Posts

Joined
Fri Nov 25, 2011 7:11 pm

Post by Hashishim » Fri Mar 02, 2012 7:45 pm

Hey

Apologies for the delay, it simple really, I am just making it into a module and will be available, it just using a workaround and does not necessarily effect much. Technically to fully utilize it as well you would have to get a combination of mods. And you would have to push the payment options on the account page and reuse it as a mechanism. It would effect the product page, the product database, and the statuses, and lastly the account and order history pages.

The downfall is you cannot track what payment option they used (Credit Card, EFT, Cash) I am currently finding a way around it probably would have to edit the checkout page with an extra question, as we using that payment option as a way of handling the deposits.

It can all be done using VQMOD:D And it wont neccessarily replace any core files:D

New member

Posts

Joined
Mon Jul 25, 2011 5:44 am
Who is online

Users browsing this forum: No registered users and 9 guests