Duplicate cc payment plugin

  • Posts: 209
  • Thank you received: 18
11 years 7 months ago #97789

Hi, I need to duplicate or replicate the credit card payment plugin to have an option just for Amex.

In Australia, payment with MasterCard & Visa there is no fee so the cc plugin works perfectly. However Amex transactions incur an additional % fee.

How can this be done?

tks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #97862

Hi,

You can copy and paste the credit card plugin, replace all the occurence of the plugin name in the php and xml files.
then apply the fee on the new created payment method.

We are currently developing a system to easily add many payment methods of the same type.

Please Log in or Create an account to join the conversation.

  • Posts: 209
  • Thank you received: 18
11 years 6 months ago #98135

Thanks Xavier

I can see there are FOUR files for the creditcard payment plugin:
creditcard.php
creditcard.xml
creditcard_configuration.php
creditcard_end.php

Not sure if I need ALL of them but I have done a copy & paste and prepended "amex" to the name of each.

With amexcreditcard.php these are the lines I changed:

Line 73: if($method->payment_type!='amexcreditcard' || !$method->enabled){
Line 101: $this->amexcreditcard = JRequest::getCmd('name','amexcreditcard');
Line 107: $element->payment_type=$this->amexcreditcard;
Line 121 to 124: $bar->appendButton( 'Pophelp','payment-creditcard-form');
hikashop_setTitle(JText::_('AMEXCREDITCARD_PAYMENT'),'plugin','plugins&plugin_type=payment&task=edit&name='.$this->amexcreditcard);
$app =& JFactory::getApplication();
$app->setUserState( HIKASHOP_COMPONENT.'.payment_plugin_type', $this->amexcreditcard);
Line 130: $element->payment_params->information = JRequest::getVar('amexcreditcard_information','','','string',JREQUEST_ALLOWRAW);
Line 138: if($order->order_payment_method=='amexcreditcard'){
Line 154: if($history->history_payment_method=='amexcreditcard' && !empty($history->history_data)){


With amexcreditcard.xml these are the lines I changed:

Line 14: <filename plugin="amexcreditcard">amexcreditcard.php</filename>
Line 15: <filename>amexcreditcard_end.php</filename>
Line 16: <filename>amexcreditcard_configuration.php</filename>



With amexcreditcard_configuration.php these lines reference the plugin. Do they also need to be changed?

Line 133: <label for="creditcard_information">
Line 135: <?php echo JText::_( 'CREDITCARD_INFORMATION' ); ?>
Line 147: <textarea rows="20" style="width:100%" name="creditcard_information"><?php echo @$this->element->payment_params->information;?></textarea>




With amexcreditcard_end.php these lines reference the plugin. Do they also need to be changed?

Line 21: <div class="hikashop_creditcard_end" id="hikashop_creditcard_end">
Line 23: <span class="hikashop_creditcard_end_message" id="hikashop_creditcard_end_message">


I may have gone a bit overboard on the changes as it fails! Could you please have a look and see if you can see where it went wrong.

Many thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #98203

The lines in the _configuration.php file and _end.php don't need to be changed.

It fails when you install the plugin ?

Thanks to give us the error message returned.

Please Log in or Create an account to join the conversation.

  • Posts: 234
  • Thank you received: 4
11 years 5 months ago #105794

Hello, I have changed the code but how do I copy & replace the plugin. Should the new coded files be in the creditcard folder or a new one within the /plugins/hikashoppayment/ folders

Yours
Iain Gwynn

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 5 months ago #105804

You should zip the new files and install the zip via the joomla installer like any other extension and that will put the files in the plugins folder automatically and register the plugin in the database.

Please Log in or Create an account to join the conversation.

  • Posts: 234
  • Thank you received: 4
11 years 5 months ago #105932

Excellent, thank you very much. I am now putting some information in the language file for the end message. How would I make it different for the amex compared to the standard credit card one. I have tried a new section beginging with ;amex but no joy.

Thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.084 seconds
Powered by Kunena Forum