I need to set recurring payment's initial fee during check out. So that I can charge customer the time when order is placed.
Does anyone know how or point me a direction? thanks
First of all, I need to make it clear that the recurring payment is made against paypal gateway shipped with default Magento. My solution is to twist a bit of method submitRecurringProfile resides in Mage_Paypal_Model_Pro.php. So I override it with MyCompany_ModuleName_Model_Paypal_Pro.php so that I can make changes to submitRecurringProfile without mess up the core file.
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile,
Mage_Payment_Model_Info $paymentInfo
) {
$profile->setData('init_amount', 100);
parent::submitRecurringProfile($profile, $paymentInfo);
}
With about function in place, initial fee will be set to 100.
Related
I am wondering, If I can change somehow the logic of creating Business Partners? The checkbox "Check double invoice" in Credit - Company Code - Vendor: Payment Transaction, is unchecked by default:
Is there any way to make this field checked by default? If someone know, could one please explain in details, if it is possible, since I am new in ABAP.
Thanks in advance.
I tried to look in SE11 LFB1 and change the initial value of the field, but it seems to me that it is unreal to change the value of standard field set by SAP itself.
I have enabled table rate shipping method in magento. Now in cart page I am getting a section called Estimate Shipping and tax.
Now in this section when I am selecting a country and clicking on estimate then I get the shipping rate according to the tablerates.csv file that I have uploaded through magento admin panel in
System->Configuration->Sales->Shipping Method->Table Rates
section.Now when I select the rate and click on update total then total is not getting updated. This problem I have on my live site.
Then I installed magento on local and does the same process, here the total gets updated when I click on update total section.
Then I checked controller action for update total button. The action of the form that contains the button is
action="http://{{site-url}}/checkout/cart/estimateUpdatePost/"
Now when I compared the estimateUpdatePost action on local and live then found that content is same
Content of estimateUpdatePost action on localhost
public function estimateUpdatePostAction()
{
$code = (string) $this->getRequest()->getParam('estimate_method');
if (!empty($code)) {
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
}
$this->_goBack();
}
Content of estimateUpdatePost action on live
public function estimateUpdatePostAction()
{
$code = (string) $this->getRequest()->getParam('estimate_method');
if (!empty($code)) {
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
}
$this->_goBack();
}
Now both the function is same.I could not understand why the total is not getting updated on live. Could anyone help me proceed in right direction.
The problem was one of the modules. Enabling and disabling the modules got me know the module due to which update total was not working.
I'm working on a survey questionnaire using xlsform for ODK. Where I'm stuck: I have a questions on the from like this: 21. Are you willing to pay for the service if it was offered at $100? The answers can be either Yes, No, or Dont know. If the respondent says Yes, the next Question will need to add $20 to the previous $100 so the question should now read as: 21. Are you willing to pay for the service if it was offered at $120? This should continue until the respondent says No. How can I implement this using xlsform design?
I understand that you need a repeat select_one loop that goes until No is selected. There is a way to do that through the indefinite-repeat XLSForm.
This is an application of it to your question:
Explanation:
The count variable is keeping track of how many times your form repeats your question.
The repeat_count field in loop_question states that your repeat should go on if (i) the repeat has ran zero times, or (ii) as soon as the answer "no" is registered in willing_pay.
The variable amount calculates the amount you should be showing in willing_pay.
Hope this helps.
I have a table 'users'. In that table there is a field balance whose datatype is ENUM('Yes','No'). Now I want to create a trigger that is fired when the balance is set to "Yes". Also I want to reset the value of Balance to NO after 30 days.
I am using PHP Codeigniter. And I have a reseller table who has its own users. So Each reseller has some users.
So when a reseller sets the balance of user to yes the trigger should
be fired and after 30 days should set user balance to NO
Also the balance of each user should be Reset uniquely. I mean one uses's balance is set to yes today and user-two balance is set to Yes tomorrow . So how will trigger know when to fire for that each specific user?
My solution is
Maintain a column like updatedon.
Write a stored procedure to set balance to NO when updatedon is 30 days and balance is YES(according to your critaria)
Run a Job daily to invoke the stored procedure(It will set only 30 days back updated records)
In order to track date you need to keep a column on which user updated_to_yes_date. When ever user update that enum column to "Yes" you should set current date to updated_to_yes_date.
Now lets code the controller for cron job.
class Cronjob extends CI_Controller {
function index() {
// Get Date before 30 days.
$today = new DateTime();
$dateBefore30days = $today->modify('-30 days');
$this->db->update('users',array('enumcolumn'=>'No'), array('enumcolumn'=>'Yes', 'updated_to_yes_date'=>date_format($dateBefore30days , 'Y-m-d'));
}
}
I have not tested above controller but it will help you.
Now its time to set up cron job. You need to run this cron job every day. To know how to setup cron job on cPanel CLICK HERE
Now we need to execute controller method from command line. For that go to codeignitor Running via the CLI document.
In our case it will be like
$ php index.php cronjob index
In many case we need to provide full path to index.php like
$ php /path/to/webroot/index.php cronjob index
Okay, I know this question has been half answered around here, but I'll explain in full and see if there maybe a better way to handle this then in just two parts.
I'm building an HTML5 voting site, that will close voting every half hour. And then open a new batch of voting.
What I need to do, is have the URL of this site be 'masked' ie:
have a random URL for it be generated that leads to the same location- so say I'm directing users to voting.com, I want them to only access it via the url votingstuff.com/hg67, and have that end portion be changed every half hour- and once the new url is generated, remove access to the site via the old URL.
I might add that after the user votes, I'd also like to close their voting access until the new URL is posted. AKA- everyone only gets one chance to vote.
Thoughts? Libraries to check out? Sites that do this? I know the randomization has been answered a few times, but usually it's a generator led to by a page, I want to START with a randomly generated URL, and not have a page that creates it as a function. I may have to write code that generates the page I guess?
Here is an approach I can think of -
You don't need to handle multiple URL's, you can achieve this on the same URL itself by enabling/disabling access to the URL content every hour.
You will need some action on your application/server side as well. For reference lets assume you have a PHP server running. You will need some table that holds a status setting for you, something like this -
Settings Table
id settingCode value
=============================
1 votingOpen 1
You will also need to setup a cron job on your server that will run every half an hour. The cron job's task would be to run every half an hour & change the value of the votingOpen to its inverse. So assume open your votings, initial value of the votingOpen field would be 1 i.e the first half an hour of voting starts.
Along with this you will start the cron job as well. Now what will happen is that after half an hour the cron job will fetch the value of votingOpen read it & if its 1, it will change it to 0 & if its 0 it will change it to 1. This will happen every half an hour on your server.
Now you need to make this votingOpen variable accessible on your client side code using a simple query to fetch its value. On each render of your voting page, on top somewhere you can check this value & if its 1 i.e true, you will write the logic to go ahead & show the voting page. But if its 0, you can redirect the user or show a different message on that page.
Lets say your voting happens on http://somedomain.com/voting, on the render logic of this page you can do something like this -
Voting View Logic
<?php
$votingOpen = {some database query that fetches the value from the database};
if($votingOpen) {
// your voting view resides here
} else {
// either redirect user to some other page
// or show some message like voting is closed on this same page.
}
?>
Limit multiple votes from one person
Normally the best way to handle this is a combination or registered user only vote + cookie/localStorage + IP tracking
But if you don't have registered user voting, you can still capture IP of user & allow only one vote per IP and you can also set a cookie or a localStorage variable in the users computer so he can only vote once.
Hope this helps.
Ref for Cron Job - http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428