Tell PayPal to automatically process the monthly payment - php

ref: https://stackoverflow.com/a/25730860/2735734
How to Tell PayPal to automatically process the monthly payment?
UPDATE 1
here is the PayPal Reponses:
CreateAgreement result:
array (
'name' => 'my name',
'description' => 'my description',
'plan' =>
array (
'id' => 'P-95307423V8719480UI4T4SGG',
'state' => 'ACTIVE',
'name' => 'title here',
'description' => 'description here',
'type' => 'INFINITE',
'payment_definitions' =>
array (
0 =>
array (
'id' => 'PD-140035022V340531AI4T4SGG',
'name' => 'Regular Payments',
'type' => 'REGULAR',
'frequency' => 'Month',
'amount' =>
array (
'currency' => 'USD',
'value' => '15.5',
),
'cycles' => '0',
'charge_models' =>
array (
0 =>
array (
'id' => 'CHM-9G272533RU378412KI4T4SGG',
'type' => 'TAX',
'amount' =>
array (
'currency' => 'USD',
'value' => '1',
),
),
),
'frequency_interval' => '1',
),
),
'merchant_preferences' =>
array (
'setup_fee' =>
array (
'currency' => 'USD',
'value' => '0',
),
'max_fail_attempts' => '0',
'return_url' => 'http://example.com/ok',
'cancel_url' => 'http://example.com/cancel',
'auto_bill_amount' => 'YES',
'initial_fail_amount_action' => 'CONTINUE',
),
),
'links' =>
array (
0 =>
array (
'href' => 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4N736816FP8632455',
'rel' => 'approval_url',
'method' => 'REDIRECT',
),
1 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-4N736816FP8632455/agreement-execute',
'rel' => 'execute',
'method' => 'POST',
),
),
'start_date' => '2014-10-25T11:54:20-00:00',
)
AND after the client approved.
ExecuteAgreement result:
array (
'id' => 'I-CD3VD66KJKXX',
'state' => 'Active',
'description' => 'my description',
'plan' =>
array (
'payment_definitions' =>
array (
0 =>
array (
'type' => 'REGULAR',
'frequency' => 'Month',
'amount' =>
array (
'currency' => 'USD',
'value' => '15.50',
),
'cycles' => '0',
'charge_models' =>
array (
0 =>
array (
'type' => 'TAX',
'amount' =>
array (
'currency' => 'USD',
'value' => '1.00',
),
),
1 =>
array (
'type' => 'SHIPPING',
'amount' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
),
),
'frequency_interval' => '1',
),
),
'merchant_preferences' =>
array (
'setup_fee' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
'max_fail_attempts' => '0',
'auto_bill_amount' => 'YES',
),
),
'links' =>
array (
0 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/suspend',
'rel' => 'suspend',
'method' => 'POST',
),
1 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/re-activate',
'rel' => 're_activate',
'method' => 'POST',
),
2 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/cancel',
'rel' => 'cancel',
'method' => 'POST',
),
3 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/bill-balance',
'rel' => 'self',
'method' => 'POST',
),
4 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/set-balance',
'rel' => 'self',
'method' => 'POST',
),
),
'start_date' => '2014-10-25T07:00:00Z',
'agreement_details' =>
array (
'outstanding_balance' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
'cycles_remaining' => '0',
'cycles_completed' => '0',
'next_billing_date' => '2014-10-25T10:00:00Z',
'final_payment_date' => '1970-01-01T00:00:00Z',
'failed_payment_count' => '0',
),
)
note the start_date for the first reponse to the second...
The first payement isn't made... (And I don't know for the other, I've try today with a daily payement... I have to wait now...)
In the Pre-Approved area on the Sandbox Account, is in Active and inform about next billing correctly.

Once the user completes and submits subscription purchase page you have created, the subscription will begin and will automatically rebill the customer's account on whatever interval you have selected. You do not have to do anything.
Updated: The REST API also automatically processes subscriptions. You do not have to resubmit monthly. The PayPal sandbox was updated in July of this year to enable you to test and process subscriptions. There are no issues being reported in the dev community about this not working, so I suspect it is something on your side.
If you haven't already. please review this:
https://developer.paypal.com/docs/integration/direct/test-the-api/
There are billing plan and billing subscription sections. If you still have a problem, post your billing plan code and the response you are receiving.

Related

How to output value of an array

I am a complete beginner in PHP. However I know how to output the value of custom field. I am having a bit of problems with arrays. The post meta key is fw_options. The value has multiple arrays and looks like this:
array (
0 =>
array (
'featured_post' => false,
'featured_expiry' => '',
'_featured_book_string' => '0',
'reading_level' => 'medium',
'reading_type' =>
array (
'time' => 'fixed',
'hourly' =>
array (
'hourly_read' => '',
'estimated_hours' => '',
),
'fixed' =>
array (
'reading_times' => '500',
),
),
'reading_duration' => 'one_month',
'english_level' => 'fluent',
'readers_level' => 'starter',
'expiry_date' => '2019/12/31',
'show_attachments' => 'off',
'read_documents' =>
array (
),
'address' => '',
'longitude' => '',
'latitude' => '',
'country' =>
array (
0 => '717',
),
),
)
I have this code which I have tried with no success:
$array = get_post_meta( get_the_ID(), 'fw_options', true );
echo $array[0]['reading_type']['fixed']['reading_times'];
How can I output the value 500 from the post meta key reading_times?
Simple Print array according to key
First hold the value into a variable than print according to array key
$data = array(
'featured_post' => false,
'featured_expiry' => '',
'_featured_book_string' => '0',
'reading_level' => 'medium',
'reading_type' =>
array(
'time' => 'fixed',
'hourly' =>
array(
'hourly_read' => '',
'estimated_hours' => '',
),
'fixed' =>
array(
'reading_times' => '500',
),
),
'reading_duration' => 'one_month',
'english_level' => 'fluent',
'readers_level' => 'starter',
'expiry_date' => '2019/12/31',
'show_attachments' => 'off',
'read_documents' =>array(),
'address' => '',
'longitude' => '',
'latitude' => '',
'country' =>
array(
0 => '717',
),
);
echo $data['reading_type']['fixed']['reading_times'];
Output #500

How to create an ARRAY in an ARRAY

I have this code (created from the admin side) in my wordpress Database postmeta table.
a:28:{s:12:"featuredItem";s:1:"0";s:10:"headerType";s:5:"image";s:11:"headerImage";s:60:"https://rocks---.de/wp-content/uploads/2018/08/IMG_2051.jpg";s:16:"headerImageAlign";s:10:"image-left";s:3:"map";a:7:{s:7:"address";s:6:"Goslar";s:8:"latitude";s:10:"51.9059531";s:9:"longitude";s:18:"10.428996299999994";s:10:"streetview";s:1:"0";s:9:"swheading";s:2:"90";s:7:"swpitch";s:1:"5";s:6:"swzoom";s:1:"1";}s:9:"telephone";s:4:"0221";s:19:"telephoneAdditional";a:3:{i:0;a:1:{s:6:"number";s:12:"111111111111";}i:1;a:1:{s:6:"number";s:13:"2222222222222";}i:2;a:1:{s:6:"number";s:13:"3333333333333";}}s:5:"email";s:20:"goslarEmail#email.de";s:9:"showEmail";s:1:"1";s:15:"contactOwnerBtn";s:1:"1";s:3:"web";s:27:"https://musicheadquarter.de";s:12:"webLinkLabel";s:17:"Label of the Link";s:19:"displayOpeningHours";s:1:"1";s:18:"openingHoursMonday";s:2:"12";s:19:"openingHoursTuesday";s:2:"12";s:21:"openingHoursWednesday";s:2:"12";s:20:"openingHoursThursday";s:2:"12";s:18:"openingHoursFriday";s:2:"12";s:20:"openingHoursSaturday";s:2:"12";s:18:"openingHoursSunday";s:2:"12";s:16:"openingHoursNote";s:26:"Text zu den Öffnungsziten";s:18:"displaySocialIcons";s:1:"1";s:26:"socialIconsOpenInNewWindow";s:1:"1";s:11:"socialIcons";a:2:{i:0;a:4:{s:5:"image";s:0:"";s:4:"icon";s:18:"fa-facebook-square";s:9:"iconColor";s:7:"#00FF00";s:4:"link";s:22:"http://rocks---.de";}i:1;a:4:{s:5:"image";s:0:"";s:4:"icon";s:12:"fa-instagram";s:9:"iconColor";s:7:"#00FF00";s:4:"link";s:20:"https://rocks---.de";}}s:14:"displayGallery";s:1:"1";s:7:"gallery";a:3:{i:0;a:2:{s:5:"title";s:6:"Bild 1";s:5:"image";s:60:"https://rocks---.de/wp-content/uploads/2019/01/IMG_8797.jpg";}i:1;a:2:{s:5:"title";s:6:"Bild 2";s:5:"image";s:60:"https://rocks---.de/wp-content/uploads/2019/01/IMG_8443.jpg";}i:2;a:2:{s:5:"title";s:6:"Bild 3";s:5:"image";s:60:"https://rocks---.de/wp-content/uploads/2018/08/IMG_8545.jpg";}}s:15:"displayFeatures";s:1:"1";s:8:"features";a:2:{i:0;a:3:{s:4:"icon";s:0:"";s:4:"text";s:15:"Feature Titel 1";s:4:"desc";s:28:"Feature Titel Beschreibung 1";}i:1;a:3:{s:4:"icon";s:0:"";s:4:"text";s:15:"Feature Titel 2";s:4:"desc";s:28:"Feature Titel Beschreibung 2";}}}
Now I tried to create the code for this ARRAY or what it is called. Everything works fine, exept the ARRAY in an ARRAY thing. Like, the list of social icons, image galelry and telephone numbers.
This is what I have so far:
$data = array(
'subtitle' => 'Utertitel',
'featuredItem' => '0',
'headerType' => 'image',
'headerImage' => 'https://rocks---.de/wp-content/uploads/slide3___beach-2179183_1920.jpg',
'headerHeight' => '375',
'map' => array(
'address' => $adresse,
'latitude' => $lat,
'longitude' => $lng,
'streetview' => '0',
'swheading' => '90',
'swpitch' => '5',
'swzoom' => '14'
),
'telephone' => '0221',
'telephoneAdditional' => '0228',
'email' => 'meister#rocks---.de',
'showEmail' => '1',
'contactOwnerBtn' => '1',
'web' => 'https://musicheadquarter.de',
'webLinkLabel' => '',
'displayOpeningHours' => '1',
'openingHoursMonday' => '12-17',
'openingHoursTuesday' => '12-17',
'openingHoursWednesday' => '12-17',
'openingHoursThursday' => '12-17',
'openingHoursFriday' => '12-17',
'openingHoursSaturday' => '12-17',
'openingHoursSunday' => '12-17',
'openingHoursNote' => 'Zusatzinfos zu den Öffnungszeiten',
'displaySocialIcons' => '0',
'socialIconsOpenInNewWindow' => '1',
'socialIcons' => array(
'icon' => 'fa-facebook-square',
'link' => 'https://rocks---.de'
),
'displayGallery' => '0',
'gallery' => array(
'title' => 'Titel des Bildes',
'image' => 'https://rocks---.de/wp-content/uploads/slide3___beach-2179183_1920.jpg'
),
'displayFeatures' => '0',
'features' => '0'
);
/* $data = maybe_serialize( $data ); */
update_post_meta( $post_id, '_ait-item_item-data', $data );
HOw do I create the ARRAY for the Images, social icons and telephone numbers.
I unserialized the Field Data and it shows the ARRAY, great!
array (
'featuredItem' => '0',
'headerType' => 'image',
'headerImage' => 'https://rockspots.de/wp-content/uploads/2018/08/IMG_2051.jpg',
'headerImageAlign' => 'image-left',
'map' =>
array (
'address' => 'Goslar',
'latitude' => '51.9059531',
'longitude' => '10.428996299999994',
'streetview' => '0',
'swheading' => '90',
'swpitch' => '5',
'swzoom' => '1',
),
'telephone' => '0221',
'telephoneAdditional' =>
array (
0 =>
array (
'number' => '111111111111',
),
1 =>
array (
'number' => '2222222222222',
),
2 =>
array (
'number' => '3333333333333',
),
),
'email' => 'goslarEmail#email.de',
'showEmail' => '1',
'contactOwnerBtn' => '1',
'web' => 'https://musicheadquarter.de',
'webLinkLabel' => 'Label of the Link',
'displayOpeningHours' => '1',
'openingHoursMonday' => '12',
'openingHoursTuesday' => '12',
'openingHoursWednesday' => '12',
'openingHoursThursday' => '12',
'openingHoursFriday' => '12',
'openingHoursSaturday' => '12',
'openingHoursSunday' => '12',
'openingHoursNote' => 'Text zu den Öffnungsziten',
'displaySocialIcons' => '1',
'socialIconsOpenInNewWindow' => '1',
'socialIcons' =>
array (
0 =>
array (
'image' => '',
'icon' => 'fa-facebook-square',
'iconColor' => '#00FF00',
'link' => 'http://festivaldate.de',
),
1 =>
array (
'image' => '',
'icon' => 'fa-instagram',
'iconColor' => '#00FF00',
'link' => 'https://rockspots.de',
),
),
'displayGallery' => '1',
'gallery' =>
array (
0 =>
array (
'title' => 'Bild 1',
'image' => 'https://rockspots.de/wp-content/uploads/2019/01/IMG_8797.jpg',
),
1 =>
array (
'title' => 'Bild 2',
'image' => 'https://rockspots.de/wp-content/uploads/2019/01/IMG_8443.jpg',
),
2 =>
array (
'title' => 'Bild 3',
'image' => 'https://rockspots.de/wp-content/uploads/2018/08/IMG_8545.jpg',
),
),
'displayFeatures' => '1',
'features' =>
array (
0 =>
array (
'icon' => '',
'text' => 'Feature Titel 1',
'desc' => 'Feature Titel Beschreibung 1',
),
1 =>
array (
'icon' => '',
'text' => 'Feature Titel 2',
'desc' => 'Feature Titel Beschreibung 2',
),
),
)
Now I need to know, how to create this part of the array. The number of images for the gallery is not fixed.
'gallery' =>
array (
0 =>
array (
'title' => 'Bild 1',
'image' => 'https://rockspots.de/wp-content/uploads/2019/01/IMG_8797.jpg',
),
1 =>
array (
'title' => 'Bild 2',
'image' => 'https://rockspots.de/wp-content/uploads/2019/01/IMG_8443.jpg',
),
2 =>
array (
'title' => 'Bild 3',
'image' => 'https://rockspots.de/wp-content/uploads/2018/08/IMG_8545.jpg',
),
),
Thanks for some tips,
Denis

Facebook messenger structured messages php not displaying php

Hopping some of you can help me with this, since a few days back I'm trying to get a list like a carousel, displayed in my FaceBook bot using the following code:
public function returnCarousel(){
$messagearray = array (
'message' =>
array (
'attachment' =>
array (
'type' => 'list',
'payload' =>
array (
'template_type' => 'list',
'top_element_style' => 'compact',
'elements' =>
array (
0 =>
array (
'title' => 'Classic T-Shirt Collection',
'subtitle' => 'See all our colors',
'image_url' => 'https://peterssendreceiveapp.ngrok.io/img/collection.png',
'buttons' =>
array (
0 =>
array (
'title' => 'View',
'type' => 'web_url',
'url' => 'https://peterssendreceiveapp.ngrok.io/collection',
'messenger_extensions' => true,
'webview_height_ratio' => 'tall',
'fallback_url' => 'https://peterssendreceiveapp.ngrok.io/',
),
),
),
1 =>
array (
'title' => 'Classic White T-Shirt',
'subtitle' => 'See all our colors',
'default_action' =>
array (
'type' => 'web_url',
'url' => 'https://peterssendreceiveapp.ngrok.io/view?item=100',
'messenger_extensions' => false,
'webview_height_ratio' => 'tall',
),
),
2 =>
array (
'title' => 'Classic Blue T-Shirt',
'image_url' => 'https://peterssendreceiveapp.ngrok.io/img/blue-t-shirt.png',
'subtitle' => '100% Cotton, 200% Comfortable',
'default_action' =>
array (
'type' => 'web_url',
'url' => 'https://peterssendreceiveapp.ngrok.io/view?item=101',
'messenger_extensions' => true,
'webview_height_ratio' => 'tall',
'fallback_url' => 'https://peterssendreceiveapp.ngrok.io/',
),
'buttons' =>
array (
0 =>
array (
'title' => 'Shop Now',
'type' => 'web_url',
'url' => 'https://peterssendreceiveapp.ngrok.io/shop?item=101',
'messenger_extensions' => true,
'webview_height_ratio' => 'tall',
'fallback_url' => 'https://peterssendreceiveapp.ngrok.io/',
),
),
),
),
'buttons' =>
array (
0 =>
array (
'title' => 'View More',
'type' => 'postback',
'payload' => 'payload',
),
),
),
),
),
);
$this->sendMessage($messagearray);
}
public function sendMessage($parameters) {
echo json_encode($parameters);
}
No carousel is displayed and no error is returnes intead I get in my ngrok console this:
{"message":{"attachment":{"type":"list","payload":{"template_type":"list","top_element_style":"compact","elements":[{"title":"Classic T-Shirt Collection","subtitle":"See all our colors","image_url":"https://peterssendreceiveapp.ngrok.io/img/collection.png","buttons":[{"title":"View","type":"web_url","url":"https://peterssendreceiveapp.ngrok.io/collection","messenger_extensions":true,"webview_height_ratio":"tall","fallback_url":"https://peterssendreceiveapp.ngrok.io/"}]},{"title":"Classic White T-Shirt","subtitle":"See all our colors","default_action":{"type":"web_url","url":"https://peterssendreceiveapp.ngrok.io/view?item=100","messenger_extensions":false,"webview_height_ratio":"tall"}},{"title":"Classic Blue T-Shirt","image_url":"https://peterssendreceiveapp.ngrok.io/img/blue-t-shirt.png","subtitle":"100% Cotton, 200% Comfortable","default_action":{"type":"web_url","url":"https://peterssendreceiveapp.ngrok.io/view?item=101","messenger_extensions":true,"webview_height_ratio":"tall","fallback_url":"https://peterssendreceiveapp.ngrok.io/"},"buttons":[{"title":"Shop Now","type":"web_url","url":"https://peterssendreceiveapp.ngrok.io/shop?item=101","messenger_extensions":true,"webview_height_ratio":"tall","fallback_url":"https://peterssendreceiveapp.ngrok.io/"}]}],"buttons":[{"title":"View More","type":"postback","payload":"payload"}]}}}}
if I send a single card it works, please your help
SOLVED: I formatted the array like this and I get it working.
$messagearray = array (
'speech' => 'Carousel',
'messages' => array (
0 => array (
'type' => 1,
'platform' => 'facebook',
'title' => 'Rosa Amarilla',
'imageUrl' => 'http://rosa.com/assets/imgs/rosaamarilla.jpg',
'buttons' =>
array (
0 =>array ('text' => 'Detalles de la Rosa', 'postback' => '',),
),
),
1 =>array (
'type' => 1,
'platform' => 'facebook',
'title' => 'Rosa Azul',
'imageUrl' => 'http://rosa.com/assets/imgs/rosaazul.jpg',
'buttons' =>
array (
0 => array ('text' => 'Detalles de la Rosa', 'postback' => '',),
),
),
),);

sugarCRM : creating relationship using module loader, package not installing

I am trying to create relationships through module loader in SugarCRM. But the problem is my package is stopped installing after 55%. When I am viewing display log the error is:-
Failed to copy
cache/upgrades/temp/SYWr9G/custom/metadata/accounts_contacts_1MetaData.php
custom/metadata/accounts_contacts_1MetaData.php
I tried to change permissions also but at some point they through internal server error 500. Following are the code which I am using.
1.In manifest.php file :
$installdefs = array(
'id' => 'package_20170804',
'copy' => array(
0 => array(
'from' => '<basepath>/accounts_contacts_1MetaData.php',
'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
),
1 => array(
'from' => '<basepath>/accounts_contacts_1.php',
'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
),
),
'relationships'=>array (
array (
'module'=> 'Accounts',
'meta_data'=>'<basepath>/custom/metadata/accounts_contacts_1MetaData.php',
'module_vardefs'=>'<basepath>/custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php'
)
),
);
2. In accounts_contacts_1MetaData.php file :
<?php
$dictionary["accounts_contacts_1"] = array (
'true_relationship_type' => 'one-to-many',
'from_studio' => true,
'relationships' =>
array (
'accounts_contacts_1' =>
array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module' => 'Contacts',
'rhs_table' => 'contacts',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'accounts_contacts_1_c',
'join_key_lhs' => 'accounts_contacts_1accounts_ida',
'join_key_rhs' => 'accounts_contacts_1contacts_idb',
),
),
'table' => 'accounts_contacts_1_c',
'fields' =>
array (
0 =>
array (
'name' => 'id',
'type' => 'varchar',
'len' => 36,
),
1 =>
array (
'name' => 'date_modified',
'type' => 'datetime',
),
2 =>
array (
'name' => 'deleted',
'type' => 'bool',
'len' => '1',
'default' => '0',
'required' => true,
),
3 =>
array (
'name' => 'accounts_contacts_1accounts_ida',
'type' => 'varchar',
'len' => 36,
),
4 =>
array (
'name' => 'accounts_contacts_1contacts_idb',
'type' => 'varchar',
'len' => 36,
),
),
'indices' =>
array (
0 =>
array (
'name' => 'accounts_contacts_1spk',
'type' => 'primary',
'fields' =>
array (
0 => 'id',
),
),
1 =>
array (
'name' => 'accounts_contacts_1_ida1',
'type' => 'index',
'fields' =>
array (
0 => 'accounts_contacts_1accounts_ida',
),
),
2 =>
array (
'name' => 'accounts_contacts_1_alt',
'type' => 'alternate_key',
'fields' =>
array (
0 => 'accounts_contacts_1contacts_idb',
),
),
),
);
3. In accounts_contacts_1.php file:
<?php
include('custom/metadata/accounts_contacts_1MetaData.php');
?>
I just wanted to create a field in relationship that's all . Maybe I am missing somewhere in manifest file or i needed to include some additional file.
I solved it. You can follow following steps to create relationships in SugarCRM through module loader.
Step 1:- Give permission to your sugar directory according to following
For Linux: http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Linux/
For Windows:
http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Windows_With_IIS/
Step 2:- In manifest.php
<?php
$manifest = array(
'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
'acceptable_sugar_versions' => array(
'exact_matches' => array(),
'regex_matches' => array('(.*?)\\.(.*?)\\.(.*?)$'),
),
'author' => 'Ravi Ranjan',
'description' => 'Relationship',
'icon' => '',
'is_uninstallable' => true,
'name' => 'custom relation',
'published_date' => '2017-08-10 2017 11:45:04',
'type' => 'module',
'version' => '20170810',
);
$installdefs = array(
'id' => 'package_20170810',
'copy' => array(
0 => array(
'from' => '<basepath>/accounts_contacts_1MetaData.php',
'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
),
1 => array(
'from' => '<basepath>/accounts_contacts_1.php',
'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
),
),
);
?>
Step 3:- The contents of both file accounts_contacts_1MetaData.php and accounts_contacts_1.php will be same as you can see in question.
Step 4:- Compress all three files and upload through module loader, after installation quick repair and rebuild.
Go in Studio > Accounts > Relationships You will see a new field there name accounts_contacts_1 That's what I wanted to create.

Get values from unserialized data

I have a serialized field in my database. I can get the contents of this field and unserialize them however I am unsure how to get certain values of these. I ultimately need a foreach of each item and value from the data.
In the below example I need to be able to get the following:
Main Image Replacement:
BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG Complimentary:
Comp Text Quote Code: Code Text
I need the label as one variable and the value as another within a foreach. These labels and values are variable so I cannot manually get this data by their labels.
array (
0 =>
array (
'mode' => 'builder',
'cssclass' => '',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'radio',
'rules_type' =>
array (
'Reprint_0' =>
array (
0 => '',
),
'Edit Artwork_1' =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => '',
'value' => 'Edit Artwork',
'price' => '',
'section' => '58073632e582b5.35893028',
'section_label' => '',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
'GBP' => '',
),
'quantity' => 1,
'multiple' => '1',
'key' => 'Edit Artwork_1',
'use_images' => '',
'changes_product_image' => '',
'imagesp' => '',
'images' => '',
),
1 =>
array (
'mode' => 'builder',
'cssclass' => '',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'radio',
'rules_type' =>
array (
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG_0' =>
array (
0 => '',
),
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-21.JPG_1' =>
array (
0 => '',
),
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-77.JPG_2' =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Main Image Replacement',
'value' => 'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG',
'price' => '',
'section' => '58073632e582d2.46631826',
'section_label' => 'Main Image Replacement',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
'GBP' => '',
),
'quantity' => 1,
'multiple' => '1',
'key' => 'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG_0',
'use_images' => 'images',
'changes_product_image' => '',
'imagesp' => '',
'images' => 'http://burhill.immaculate.co.uk/wp-content/uploads/2016/10/BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14-150x150.jpg',
),
2 =>
array (
'mode' => 'builder',
'cssclass' => 'col-6',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'textfield',
'rules_type' =>
array (
0 =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Complimentary',
'value' => 'Comp Text',
'price' => '',
'section' => '58073632e582f4.32183997',
'section_label' => 'Complimentary',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
),
'quantity' => 1,
),
3 =>
array (
'mode' => 'builder',
'cssclass' => 'col-6',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'textfield',
'rules_type' =>
array (
0 =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Quote Code',
'value' => 'Code Text',
'price' => '',
'section' => '58073632e58317.46363272',
'section_label' => 'Quote Code',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
),
'quantity' => 1,
),
)
foreach($your_array as $key => $value) {
$your_value = $value['value'];
$your_label = $value['section_label'];
}
This should work for you as long as i got the right keys there.

Categories