Display "validity_end" from Time limited Hikaserial Generator Plugin
7 years 4 months ago #307875
by Jabatec
Javier Ballester
Hi,
I am working on the generation of serials through Time limited generator plugin, and also, I give the option to send the serial as a gift to another user via the MailToCustomField plugin - HikaSerial plugin.
All work fine, but the info that send to the buyer and/or user (mail custom) does not have the expiration date (validity_end). Also, email send to user (mailtocustomfield) not info about the name of product, (Serials are linked to the purchase of a product hikashop)
Would it be possible to incorporate this information in?
A-info) HikaSerial - orderserial / show_email_notification_html.php
(I think that this code example, wil be ok also for emails templates of order status, order pay, etc...)
B-info) System / Emails / Serial : Mail to custom field
Also is important know that the data (serial.extradata.discount_end) is a timestamp and I would need use the format "date" to display it
Thank you. Best regards.
Javier
I am working on the generation of serials through Time limited generator plugin, and also, I give the option to send the serial as a gift to another user via the MailToCustomField plugin - HikaSerial plugin.
All work fine, but the info that send to the buyer and/or user (mail custom) does not have the expiration date (validity_end). Also, email send to user (mailtocustomfield) not info about the name of product, (Serials are linked to the purchase of a product hikashop)
Would it be possible to incorporate this information in?
A-info) HikaSerial - orderserial / show_email_notification_html.php
(I think that this code example, wil be ok also for emails templates of order status, order pay, etc...)
B-info) System / Emails / Serial : Mail to custom field
Also is important know that the data (serial.extradata.discount_end) is a timestamp and I would need use the format "date" to display it
Thank you. Best regards.
Javier
Javier Ballester
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307876
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
Hello,
validity_end contains a timestamp for the date (as HikaShop do) ; so if you want to display that value, you need to use the hikashop_getDate function to make it understandable by a human being.
You need a bit of PHP if you want to access the validity_end since it's something stored into the serial "extra_data" (which is seen as an array)
www.hikashop.com/forum/17-serial-how-to/...on-email.html#209037
The "mail to custom field" display few elements by default and if you want to display more, you need to customize the email by using the tags or some PHP.
If you look at the PHP in the "preload" part of the email you will see that the serial and its extra data are loaded ; but you will need to add some PHP code to convert the validity_end into text (by using the hikashop function and, only if the value is available).
You can add that text into a new entry of the "$d" array, so it will be faster to display it in the HTML email using the tag (as it is done for the "DATA")
Regards,
validity_end contains a timestamp for the date (as HikaShop do) ; so if you want to display that value, you need to use the hikashop_getDate function to make it understandable by a human being.
You need a bit of PHP if you want to access the validity_end since it's something stored into the serial "extra_data" (which is seen as an array)
www.hikashop.com/forum/17-serial-how-to/...on-email.html#209037
The "mail to custom field" display few elements by default and if you want to display more, you need to customize the email by using the tags or some PHP.
If you look at the PHP in the "preload" part of the email you will see that the serial and its extra data are loaded ; but you will need to add some PHP code to convert the validity_end into text (by using the hikashop function and, only if the value is available).
You can add that text into a new entry of the "$d" array, so it will be faster to display it in the HTML email using the tag (as it is done for the "DATA")
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307927
by Jabatec
Javier Ballester
Replied by Jabatec on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
Hi Jerome,
I have been able to show 2 types of Serial Extradata in the Front view / my_template / View view HikaSerial / File orderserial show_order_front_show
1- Date validity_end and format date (Time limited plugin - HikaSerial Generator plugin)
code
2- Serial extra data (custom value)
code
All work fine in file orderserial show_order_front_show
But I need to work with this data in the back end view to include them in the email. I am working on the view "orderserial" file "show_email_notification_html" but my code is not valid.
I would appreciate an example of code to be able to get serial_extradata to the file "show_email_notification_html"
Thank you very much
Javier
I have been able to show 2 types of Serial Extradata in the Front view / my_template / View view HikaSerial / File orderserial show_order_front_show
1- Date validity_end and format date (Time limited plugin - HikaSerial Generator plugin)
code
Code:
echo date ('d-M-Y', $ data-> serial_extradata ['validity_end'])
2- Serial extra data (custom value)
code
Code:
echo $ data-> serial_extradata ['mydatafield']
All work fine in file orderserial show_order_front_show
But I need to work with this data in the back end view to include them in the email. I am working on the view "orderserial" file "show_email_notification_html" but my code is not valid.
I would appreciate an example of code to be able to get serial_extradata to the file "show_email_notification_html"
Thank you very much
Javier
Javier Ballester
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307928
by Jabatec
Javier Ballester
Replied by Jabatec on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
Hi Jerome, more code
Email template "Serial: Mail to custom field" , it is tiny, but we can include the expiration date (validity_end plugin) with ... :woohoo:
Preload Version
Html Version
Also....
... frontend / my template / orderserial / show_email_notification_html, can show serial extradata, expiration date (validity_end and format) and a custom value with the code :woohoo:
Also
... backend / my template / orderserial / show_email_notification_html, can show fine assign date format with the code :woohoo:
Only, backend and validity_date
... backend / my template / orderserial / show_email_notification_html
it is a war , it don't show date validity_end with backend show_email_notification_html with the code :S
This code show de same date that serial_assign_date and not validity_date
and I do not understand what is happening
Thank you
Javier
Email template "Serial: Mail to custom field" , it is tiny, but we can include the expiration date (validity_end plugin) with ... :woohoo:
Preload Version
Code:
$d = array(
'DATA' => $serial->serial_data,
'serial' => $serial,
'extra' => $serial->serial_extradata,
'MyValidityEnd' => date('d-M-Y',$serial->serial_extradata['validity_end'])
Html Version
Code:
<ul>
<!--{START:SERIAL}-->
<li>{LINEVAR:DATA}</li>
<!--peronalizado-->
<li>{LINEVAR:MyValidityEnd}</li>
<!-- fin personalizado -->
<!--{END:SERIAL}-->
</ul>
Also....
... frontend / my template / orderserial / show_email_notification_html, can show serial extradata, expiration date (validity_end and format) and a custom value with the code :woohoo:
Code:
echo date('d-M-Y',$data->serial_extradata['validity_end'])
Also
... backend / my template / orderserial / show_email_notification_html, can show fine assign date format with the code :woohoo:
Code:
echo hikaserial::getDate($data->serial_assign_date,'d-M-Y')
Only, backend and validity_date
... backend / my template / orderserial / show_email_notification_html
it is a war , it don't show date validity_end with backend show_email_notification_html with the code :S
This code show de same date that serial_assign_date and not validity_date
Code:
echo hikaserial::getDate($data->serial_extradata[validity_date],'d-M-Y')
and I do not understand what is happening
Thank you
Javier
Javier Ballester
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307940
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
Hello,
That code is not valide code
1 - there is no quotes for the array entry
2 - the array entry name is not correct.
Please clarify (and summarize) your issue.
Regards,
That code is not valide code
Code:
echo hikaserial::getDate($data->serial_extradata[validity_date],'d-M-Y')
2 - the array entry name is not correct.
Please clarify (and summarize) your issue.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
7 years 4 months ago #308069
by Jabatec
Javier Ballester
Replied by Jabatec on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
HI,
1-) Hikashop / System / emails - Serial: mail to custom field -
In the template I have included the serial expiration date (validity_end), but I need know preload version for include the product name (Serial Attached product name) in the email Serial: mail to custom field.
Preload version
Html version
2-) Hikaserial - Views
HikaSerial - orderserial / show_email_notification_html.php (Backend)
Serial data , and product name work fine , but i would need display serial ‘validity_end” (extradata) in the show_email_notification_html.php
Regards
Javier
1-) Hikashop / System / emails - Serial: mail to custom field -
In the template I have included the serial expiration date (validity_end), but I need know preload version for include the product name (Serial Attached product name) in the email Serial: mail to custom field.
Preload version
Code:
$d = array(
'DATA' => $serial->serial_data,
'serial' => $serial,
'extra' => $serial->serial_extradata,
‘expiration’=> date('d-M-Y',$serial->serial_extradata['validity_end']),
‘attached_product_name’ =>
);
Html version
Code:
<ul>
<li>{LINEVAR:DATA}</li>
<li>{LINEVAR:expiration}</li>
<li>{LINEVAR:attached_product_name}</li>
</ul>
2-) Hikaserial - Views
HikaSerial - orderserial / show_email_notification_html.php (Backend)
Serial data , and product name work fine , but i would need display serial ‘validity_end” (extradata) in the show_email_notification_html.php
Regards
Javier
Javier Ballester
Please Log in or Create an account to join the conversation.
7 years 4 months ago #308092
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Display "validity_end" from Time limited Hikaserial Generator Plugin
Hello,
The backend view do not have the exact same code than the front-end one ; the extra data are not serialized, but I will add a patch to perform it.
In the mean time, you can add that code
So it will do the "unserialize" if the serial_extradata is a string (so a serialized data)
Afterwards, please don't hesitate to use debug function like "var_dump" or "print_r" in order to get the content of a variable.
If you do it on the $serial object, you will get all its content and since the serials in email are loaded with the pack and order_product data ; you will have access to the order_product_name and much more !
Regards,
The backend view do not have the exact same code than the front-end one ; the extra data are not serialized, but I will add a patch to perform it.
In the mean time, you can add that code
Code:
if(!empty($data->serial_extradata) && is_string($data->serial_extradata))
$data->serial_extradata = hikaserial::unserialize($data->serial_extradata);
Afterwards, please don't hesitate to use debug function like "var_dump" or "print_r" in order to get the content of a variable.
If you do it on the $serial object, you will get all its content and since the serials in email are loaded with the pack and order_product data ; you will have access to the order_product_name and much more !
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.108 seconds