i try to use the custom actions when some orders an Item.
The documentaion is not helping me
At the documentaion there is explained that i have to create a file with this content:
<?phpclass custom_actions_file{ /** * Item Purchased (run before onPurchaseGenerated) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @return void */ public function onPaid( $member, $package, $invoice ) { } /** * Purchase record generated (run after onPaid) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array Row from nexus_purchases [since Nexus 1.5] * @return void */ public function onPurchaseGenerated( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed, but was still active anyway * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onRenew( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed after had expired * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Invoice Model [May not be set if manually reactivating] * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onReactivate( $member, $package, $invoice, $purchase ) { } /** * Purchase Expired * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is expiring because the invoice which previously renewed it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onExpire( $member, $package, $invoice, $purchase ) { } /** * Purchase Cancelled or Deleted * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is being cancelled because the invoice which was used to purchase it it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onCancel( $member, $package, $invoice, $purchase ) { } /** * Purchase is transferred to another member * * @param array Old owner * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param customer New owner * @return void */ public function onTransfer( $oldOwner, $package, $purchase, $newOwner ) { } /** * Purchase is upgraded/downgraded * * @param array The member the purchase belongs to * @param array Old package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param package New package object * @return void */ public function onChange( $member, $oldPackage, $purchase, $newPackage ) { } /** * Purchases' parent purchase is changed * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param array|null The previous parent (may be null if had no parent previously) * @param array|null The new parent (may be null if was previously associated and now not) * @return void */ public function onAssociate( $member, $package, $purchase, $oldParent, $newParent ) { }}
OK i called this file: file.php in folder: /applications_addon/ips/nexus/sources/actions/
I added file.php at the Package in Actions.
So i changed it that php sould write me a file.
So Code looks now:
<?phpclass custom_actions_file{ /** * Item Purchased (run before onPurchaseGenerated) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @return void */ public function onPaid( $member, $package, $invoice, $ourFileName, $ourFileHandle ) { $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); } /** * Purchase record generated (run after onPaid) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array Row from nexus_purchases [since Nexus 1.5] * @return void */ public function onPurchaseGenerated( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed, but was still active anyway * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onRenew( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed after had expired * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Invoice Model [May not be set if manually reactivating] * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onReactivate( $member, $package, $invoice, $purchase ) { } /** * Purchase Expired * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is expiring because the invoice which previously renewed it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onExpire( $member, $package, $invoice, $purchase ) { } /** * Purchase Cancelled or Deleted * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is being cancelled because the invoice which was used to purchase it it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onCancel( $member, $package, $invoice, $purchase ) { } /** * Purchase is transferred to another member * * @param array Old owner * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param customer New owner * @return void */ public function onTransfer( $oldOwner, $package, $purchase, $newOwner ) { } /** * Purchase is upgraded/downgraded * * @param array The member the purchase belongs to * @param array Old package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param package New package object * @return void */ public function onChange( $member, $oldPackage, $purchase, $newPackage ) { } /** * Purchases' parent purchase is changed * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param array|null The previous parent (may be null if had no parent previously) * @param array|null The new parent (may be null if was previously associated and now not) * @return void */ public function onAssociate( $member, $package, $purchase, $oldParent, $newParent ) { }}
But nothing will happen when i buy this pakage.
I thought there should now a file be created called "testFile.txt".
Can someone explain me what i have to do here?
Thank you very much.
Regards
EDIT:
OMG i am so stupid
Just type in the name of the file without .php in "Actions" at your product.
Question
Guest Hans0815
Hello,
i try to use the custom actions when some orders an Item.
The documentaion is not helping me
At the documentaion there is explained that i have to create a file with this content:
<?phpclass custom_actions_file{ /** * Item Purchased (run before onPurchaseGenerated) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @return void */ public function onPaid( $member, $package, $invoice ) { } /** * Purchase record generated (run after onPaid) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array Row from nexus_purchases [since Nexus 1.5] * @return void */ public function onPurchaseGenerated( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed, but was still active anyway * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onRenew( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed after had expired * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Invoice Model [May not be set if manually reactivating] * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onReactivate( $member, $package, $invoice, $purchase ) { } /** * Purchase Expired * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is expiring because the invoice which previously renewed it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onExpire( $member, $package, $invoice, $purchase ) { } /** * Purchase Cancelled or Deleted * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is being cancelled because the invoice which was used to purchase it it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onCancel( $member, $package, $invoice, $purchase ) { } /** * Purchase is transferred to another member * * @param array Old owner * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param customer New owner * @return void */ public function onTransfer( $oldOwner, $package, $purchase, $newOwner ) { } /** * Purchase is upgraded/downgraded * * @param array The member the purchase belongs to * @param array Old package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param package New package object * @return void */ public function onChange( $member, $oldPackage, $purchase, $newPackage ) { } /** * Purchases' parent purchase is changed * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param array|null The previous parent (may be null if had no parent previously) * @param array|null The new parent (may be null if was previously associated and now not) * @return void */ public function onAssociate( $member, $package, $purchase, $oldParent, $newParent ) { }}OK i called this file: file.php in folder: /applications_addon/ips/nexus/sources/actions/
I added file.php at the Package in Actions.
So i changed it that php sould write me a file.
So Code looks now:
<?phpclass custom_actions_file{ /** * Item Purchased (run before onPurchaseGenerated) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @return void */ public function onPaid( $member, $package, $invoice, $ourFileName, $ourFileHandle ) { $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); } /** * Purchase record generated (run after onPaid) * * @param array The member purchasing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array Row from nexus_purchases [since Nexus 1.5] * @return void */ public function onPurchaseGenerated( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed, but was still active anyway * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice Invoice Model * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onRenew( $member, $package, $invoice, $purchase ) { } /** * Purchase Renewed after had expired * * @param array The member renewing * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Invoice Model [May not be set if manually reactivating] * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onReactivate( $member, $package, $invoice, $purchase ) { } /** * Purchase Expired * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is expiring because the invoice which previously renewed it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onExpire( $member, $package, $invoice, $purchase ) { } /** * Purchase Cancelled or Deleted * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param invoice|null Will usually be null. If the purchase is being cancelled because the invoice which was used to purchase it it is now being marked unpaid, the invoice object will be passed. * @param array The row from nexus_purchases [since Nexus 1.5] * @return void */ public function onCancel( $member, $package, $invoice, $purchase ) { } /** * Purchase is transferred to another member * * @param array Old owner * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param customer New owner * @return void */ public function onTransfer( $oldOwner, $package, $purchase, $newOwner ) { } /** * Purchase is upgraded/downgraded * * @param array The member the purchase belongs to * @param array Old package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param package New package object * @return void */ public function onChange( $member, $oldPackage, $purchase, $newPackage ) { } /** * Purchases' parent purchase is changed * * @param array The member the purchase belongs to * @param array Package data (combined array with row from nexus_packages and nexus_packages_*, depending on the package type) * @param array The row from nexus_purchases * @param array|null The previous parent (may be null if had no parent previously) * @param array|null The new parent (may be null if was previously associated and now not) * @return void */ public function onAssociate( $member, $package, $purchase, $oldParent, $newParent ) { }}But nothing will happen when i buy this pakage.
I thought there should now a file be created called "testFile.txt".
Can someone explain me what i have to do here?
Thank you very much.
Regards
EDIT:
OMG i am so stupid
Just type in the name of the file without .php in "Actions" at your product.
At the end of the line there is allready ".php"
Sorry for that thread here.
Edited by Hans0815Link to comment
Share on other sites
1 answer to this question
Recommended Posts