[Skip to main content](#vessel-content)

#   Recording Offline Payments

##

- **[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")**
- [![pkelly's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30719-pkelly "View pkelly's Profile") Topic Author
- [ Offline](/forum/user/30719-pkelly)

Less More

- Posts: 3
- Thank you received: 1
-
-

12 years 6 months ago [\#150877](#150877) by [pkelly](/forum/user/30719-pkelly "View pkelly's Profile")  *[Recording Offline Payments](/forum/29-payment-methods/867185-recording-offline-payments#150877 "-- url of the page with the problem -- : n/a -- HikaShop version -- : 1312231536 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : n/a -- Error-message(debug-mod must be tuned on) -- : Error&#95;message n/a  I have some customers that pay in full via the paypal plugin before their order is shipped, but I also have some customers that make cash down payments and do not pay the remainder until after they receive their order.  I need to be able to manually record partial payments made in cash from the backend, but I want the information to be stored the same way as paypal payments are stored - for consistency's sake.  My though process was to add a field to the &quot;Edit order additional information&quot; popup located on the edit order page. The field would updated the history&#95;amount field in the &#95;&#95;hikashop&#95;history table.  I think that is the only place in the database that I would need to record the payment amount, but I could be wrong. Also, I am not sure which file(s) to edit to accomplish this and would rather not spend hours looking for it if I don't have to.  If someone could please chime in to point me in the right direction or perhaps even suggest an easier method I would greatly appreciate it.  I am, of course, happy to share my modifications so others with similar needs can benefit, I will post back to this thread once I have some workable code.  Thank you in advance!")* was created by *[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")*

-- url of the page with the problem -- : n/a
-- HikaShop version -- : 1312231536
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : n/a
-- Error-message(debug-mod must be tuned on) -- : Error_message n/a

I have some customers that pay in full via the paypal plugin before their order is shipped, but I also have some customers that make cash down payments and do not pay the remainder until after they receive their order.

I need to be able to manually record partial payments made in cash from the backend, but I want the information to be stored the same way as paypal payments are stored - for consistency's sake.

My though process was to add a field to the "Edit order additional information" popup located on the edit order page. The field would updated the history_amount field in the __hikashop_history table.

I think that is the only place in the database that I would need to record the payment amount, but I could be wrong. Also, I am not sure which file(s) to edit to accomplish this and would rather not spend hours looking for it if I don't have to.

If someone could please chime in to point me in the right direction or perhaps even suggest an easier method I would greatly appreciate it.

I am, of course, happy to share my modifications so others with similar needs can benefit, I will post back to this thread once I have some workable code.

Thank you in advance!
[ ![ha7b7d46.png](/forum/attachment/16504) ](/forum/attachment/16504 "ha7b7d46.png")

- [ ![ha7b7d46.png](/forum/attachment/16504) ](/forum/attachment/16504 "ha7b7d46.png") [ ](/forum/attachment/16504?download=1 "ha7b7d46.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NjcxODUtcmVjb3JkaW5nLW9mZmxpbmUtcGF5bWVudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")**
- [![pkelly's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30719-pkelly "View pkelly's Profile") Topic Author
- [ Offline](/forum/user/30719-pkelly)

Less More

- Posts: 3
- Thank you received: 1
-
-

12 years 6 months ago [\#150880](#150880) by [pkelly](/forum/user/30719-pkelly "View pkelly's Profile")  Replied by *[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")* on topic *[Recording Offline Payments](/forum/29-payment-methods/867185-recording-offline-payments#150880 "-- url of the page with the problem -- : n/a -- HikaShop version -- : 1312231536 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : n/a -- Error-message(debug-mod must be tuned on) -- : Error&#95;message n/a  I have some customers that pay in full via the paypal plugin before their order is shipped, but I also have some customers that make cash down payments and do not pay the remainder until after they receive their order.  I need to be able to manually record partial payments made in cash from the backend, but I want the information to be stored the same way as paypal payments are stored - for consistency's sake.  My though process was to add a field to the &quot;Edit order additional information&quot; popup located on the edit order page. The field would updated the history&#95;amount field in the &#95;&#95;hikashop&#95;history table.  I think that is the only place in the database that I would need to record the payment amount, but I could be wrong. Also, I am not sure which file(s) to edit to accomplish this and would rather not spend hours looking for it if I don't have to.  If someone could please chime in to point me in the right direction or perhaps even suggest an easier method I would greatly appreciate it.  I am, of course, happy to share my modifications so others with similar needs can benefit, I will post back to this thread once I have some workable code.  Thank you in advance!")*

Made this addition to administrator/components/com_hikashop/views/order/tmpl/edit_additional.php around line 187:
Code:

&lt;dd class="hikashop_orderadditional_history"&gt; &lt;span&gt; &lt;input onchange="window.orderMgr.orderadditional_history_changed(this);" type="checkbox" id="hikashop_history_orderadditional_store" name="data[history][store_data]" value="1"/&gt; &lt;label for="hikashop_history_orderadditional_store" style="display:inline-block"&gt; &lt;?php echo JText::_('SET_HISTORY_MESSAGE');?&gt; &lt;/label&gt; &lt;/span&gt; &lt;br/&gt; &lt;textarea id="hikashop_history_orderadditional_msg" name="data[history][msg]" style="display:none;"&gt;&lt;/textarea&gt; &lt;/dd&gt; &lt;!-- start addition by pk --&gt; &lt;dd class="hikashop_orderadditional_history"&gt; &lt;span&gt; &lt;input onchange="window.orderMgr.orderadditional_history_amt_changed(this);" type="checkbox" id="hikashop_history_amt_orderadditional_store" name="data[history][store_data]" value="1"/&gt; &lt;label for="hikashop_history_amt_orderadditional_store" style="display:inline-block"&gt; &lt;?php echo JText::_('Record Payment');?&gt; &lt;/label&gt; &lt;/span&gt; &lt;br/&gt; &lt;input type="text" id="hikashop_history_amt_orderadditional" name="data[history][amt]" style="display:none;" /&gt; &lt;/dd&gt; &lt;!-- end addition by pk --&gt; &lt;dd class="hikashop_orderadditional_usermsg"&gt;

Made this addition to same file around line 213:
Code:

&lt;!-- start addition by pk --&gt; &lt;script type="text/javascript"&gt; if(!window.orderMgr) window.orderMgr = {}; window.orderMgr.orderadditional_history_amt_changed = function(el) { var fields = ['hikashop_history_amt_orderadditional'], displayValue = ''; if(!el.checked) displayValue = 'none'; window.hikashop.setArrayDisplay(fields, displayValue); } &lt;/script&gt; &lt;!-- end addition by pk --&gt;

I have a field now, but am not sure how to make it update the correct database field. I have tried looking at the following files, but nothing is jumping out at me ...

administrator/components/com_hikashop/controllers/order.php,
administrator/components/com_hikashop/classes/order.php
administrator/components/com_hikashop/classes/field.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NjcxODUtcmVjb3JkaW5nLW9mZmxpbmUtcGF5bWVudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14271
-
-

12 years 6 months ago [\#150993](#150993) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Recording Offline Payments](/forum/29-payment-methods/867185-recording-offline-payments#150993 "-- url of the page with the problem -- : n/a -- HikaShop version -- : 1312231536 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : n/a -- Error-message(debug-mod must be tuned on) -- : Error&#95;message n/a  I have some customers that pay in full via the paypal plugin before their order is shipped, but I also have some customers that make cash down payments and do not pay the remainder until after they receive their order.  I need to be able to manually record partial payments made in cash from the backend, but I want the information to be stored the same way as paypal payments are stored - for consistency's sake.  My though process was to add a field to the &quot;Edit order additional information&quot; popup located on the edit order page. The field would updated the history&#95;amount field in the &#95;&#95;hikashop&#95;history table.  I think that is the only place in the database that I would need to record the payment amount, but I could be wrong. Also, I am not sure which file(s) to edit to accomplish this and would rather not spend hours looking for it if I don't have to.  If someone could please chime in to point me in the right direction or perhaps even suggest an easier method I would greatly appreciate it.  I am, of course, happy to share my modifications so others with similar needs can benefit, I will post back to this thread once I have some workable code.  Thank you in advance!")*

Hi,

You need to add your custom code to save it near the end of the saveForm function of administrator/components/com_hikashop/classes/order.php

Note that in your first piece of code, your input has the same name as the input of the history message input which shouldn't be the case.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NjcxODUtcmVjb3JkaW5nLW9mZmxpbmUtcGF5bWVudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")**
- [![pkelly's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/30719-pkelly "View pkelly's Profile") Topic Author
- [ Offline](/forum/user/30719-pkelly)

Less More

- Posts: 3
- Thank you received: 1
-
-

12 years 6 months ago [\#151013](#151013) by [pkelly](/forum/user/30719-pkelly "View pkelly's Profile")  Replied by *[pkelly](/forum/user/30719-pkelly "View pkelly's Profile")* on topic *[Recording Offline Payments](/forum/29-payment-methods/867185-recording-offline-payments#151013 "-- url of the page with the problem -- : n/a -- HikaShop version -- : 1312231536 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.28 -- Browser(s) name and version -- : n/a -- Error-message(debug-mod must be tuned on) -- : Error&#95;message n/a  I have some customers that pay in full via the paypal plugin before their order is shipped, but I also have some customers that make cash down payments and do not pay the remainder until after they receive their order.  I need to be able to manually record partial payments made in cash from the backend, but I want the information to be stored the same way as paypal payments are stored - for consistency's sake.  My though process was to add a field to the &quot;Edit order additional information&quot; popup located on the edit order page. The field would updated the history&#95;amount field in the &#95;&#95;hikashop&#95;history table.  I think that is the only place in the database that I would need to record the payment amount, but I could be wrong. Also, I am not sure which file(s) to edit to accomplish this and would rather not spend hours looking for it if I don't have to.  If someone could please chime in to point me in the right direction or perhaps even suggest an easier method I would greatly appreciate it.  I am, of course, happy to share my modifications so others with similar needs can benefit, I will post back to this thread once I have some workable code.  Thank you in advance!")*

Thank you for pointing me in the right direct Nicolas!
*This attachment is hidden for guests.
Please log in or register to see it.*

Attached is a zip archive of the files I edited and a readme.txt file that shows where they go in the filesystem. All edits are wrapped in comments. I am sure it can be improved upon (specifically the automation of the currency code when entering payments). Very limited testing was done on a shared hosting environment with apache server running PHP 5.3 with IE 8, Chrome 33 and Firefox 26. (that means I tried it once in each browser and it worked).

**Summary of Edits:**

Corrected the name attribute on the checkbox added to edit_additional.php. (code in previous post)

Added the following code to order.php around line 657: Code:

if(!empty($data['history']['store_pmt'])) { if(isset($data['history']['amount'])){ $order-&gt;history-&gt;history_amount = $data['history']['amount']; $order-&gt;history-&gt;history_type = 'payment'; } else{ $order-&gt;history-&gt;history_amount = @$data['history']['history_amount']; $order-&gt;history-&gt;history_type = 'payment'; } }

Added the following line to en-GB.com_hikashop,ini around line 1816: Code:

SET_HISTORY_PMT_AMT="Set payment amount (Format: '1.00USD')"

Added the following two code snippets to the front end order template 'show.php' under Display-&gt;Views to display payments made to users when they log in and view the order:
Code:

&lt;tr&gt; &lt;td colspan='&lt;?php echo $colspan;?&gt;'&gt; &lt;/td&gt; &lt;td class='hikashop_order_total_title key'&gt; &lt;label&gt;Payments&lt;/label&gt; &lt;/td&gt; &lt;td class='hikashop_order_total_value' &gt; &lt;?php $db = JFactory::getDbo(); $query = $db-&gt;getQuery(true); $query-&gt;select($db-&gt;quoteName(array('history_amount', 'history_data','history_created'))); $query-&gt;from($db-&gt;quoteName('#__hikashop_history')); $conditions = array( $db-&gt;quoteName('history_order_id') . '=\'' . $this-&gt;element-&gt;order_id . '\'', $db-&gt;quoteName('history_type') . '=\'payment\'' ); $query-&gt;where($conditions); $db-&gt;setQuery($query); $db-&gt;setQuery($query); $row = $db-&gt;loadRowList(); $numRows = count($row); $i=0; $myTotalPmts = 0; while ($i&lt;$numRows){ preg_match('/[A-Za-z]/', $row[$i][0], $matches, PREG_OFFSET_CAPTURE); $myPayAmt = substr($row[$i][0],0,$matches[0][1]); $myTotalPmts = $myTotalPmts + $myPayAmt; $i++; } setlocale(LC_MONETARY, 'en_US'); echo money_format('%n',$myTotalPmts); ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php $myTotal = substr($this-&gt;order-&gt;order_full_price,0,-1); $myDueAmt = $myTotal - $myTotalPmts; ?&gt; &lt;tr&gt; &lt;td colspan='&lt;?php echo $colspan;?&gt;'&gt; &lt;/td&gt; &lt;td class='hikashop_order_total_title key'&gt; &lt;label&gt;Total Due&lt;/label&gt; &lt;/td&gt; &lt;td class='hikashop_order_total_value' &gt; &lt;?php echo money_format('%n', $myDueAmt);?&gt; &lt;/td&gt; &lt;/tr&gt;

Code:

&lt;tr&gt; &lt;td&gt; &lt;fieldset&gt; &lt;legend&gt;Payment Information&lt;/legend&gt; &lt;table cellpadding="1" width="100%"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th style="text-align:left;"&gt;Date&lt;/th&gt; &lt;th style="text-align:left;"&gt;Amount&lt;/th&gt; &lt;th style="text-align:left;"&gt;Details&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php $i = 0; while ($i&lt;$numRows){ echo "&lt;tr&gt;&lt;td&gt;"; echo date_format(date_create($row[i][2]), 'm-d-Y'); echo "&lt;/td&gt;&lt;td&gt;"; preg_match('/[A-Za-z]/', $row[$i][0], $matches, PREG_OFFSET_CAPTURE); $myPayAmt = substr($row[$i][0],0,$matches[0][1]); echo money_format('%n', $myPayAmt); echo "&lt;/td&gt;&lt;td&gt;"; echo $row[$i][1]; echo "&lt;/td&gt;&lt;/tr&gt;"; $i++; } ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/fieldset&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;fieldset&gt; &lt;legend&gt;Shipping Information&lt;/legend&gt; &lt;table cellpadding="1" width="100%"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th style="text-align:left;"&gt;Shipper&lt;/th&gt; &lt;th style="text-align:left;"&gt;Tracking Number&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt; &lt;?php echo $this-&gt;element-&gt;order_shipping_method;?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php switch ($this-&gt;element-&gt;order_shipping_method){ case 'usps': echo "&lt;a target='_blank' href='https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=" . $this-&gt;element-&gt;tracking_number . "'&gt;" . $this-&gt;element-&gt;tracking_number . "&lt;/a&gt;"; break; case 'ups': echo "&lt;a target='_blank' href='http://wwwapps.ups.com/WebTracking/track?track=yes&amp;trackNums=" . $this-&gt;element-&gt;tracking_number . "'&gt;" . $this-&gt;element-&gt;tracking_number . "&lt;/a&gt;"; break; case 'fedex': echo "&lt;a target='_blank' href='http://www.fedex.com/Tracking?action=track&amp;tracknumbers=" . $this-&gt;element-&gt;tracking_number . "'&gt;" . $this-&gt;element-&gt;tracking_number . "&lt;/a&gt;"; break; } ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/fieldset&gt; &lt;/td&gt; &lt;/tr&gt;

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NjcxODUtcmVjb3JkaW5nLW9mZmxpbmUtcGF5bWVudHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.136 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
