Tagged: php, woocommerce
-
AuthorPosts
-
March 30, 2017 at 10:13 pm #769664
Hi,
I have been loving this theme since the start. Really a joy to work with. Now I’m trying to make my Custom Product Properties to show in an area created by the contentmodule within the Advanced Layout Builder. The area itself is a ‘tabbed area’.
So, I’ve installed the plugin (Woocommerce Custom Fields).
My problem is that I cant find a way to ‘print/show’ the values from my customfields. I get the feeling it’s because they are shown by PHP. Here’s an example:
<?php wccf_print_product_field(array('key' => 'UNIQUE_FIELD_KEY')); ?>
. This exampel can be found at this link.As You can see from the image below, I’ve created a infotable by pasting html into the ‘tabbed area module’.
My goal is to create a property per property in the two tables (thats gonna work fine through the plugin, so that’s not your problem :-)), and then show the values within these product properties in the tables by pasting in the ‘unique field key’. And thats my problem, the printing of the value is through a php-snippet as shown above.
As an example, I would like the first item in the table to look like this:
[av_row row_style=''][av_cell col_style='']<strong>Ledaruppbyggnad</strong>[/av_cell][av_cell col_style='']<?php wccf_print_product_prop_value(array('key' => 'UNIQUE_FIELD_KEY01')); ?>[/av_cell][/av_row]
.The next item in the table will obviously look like this:
[av_row row_style=''][av_cell col_style='']<strong>Ledaruppbyggnad</strong>[/av_cell][av_cell col_style='']<?php wccf_print_product_prop_value(array('key' => 'UNIQUE_FIELD_KEY02')); ?>[/av_cell][/av_row]
Tell me if you need any extra information in order to nudge me in the right direction.
Best regards
Christian- This topic was modified 7 years, 7 months ago by ChristianEnglen. Reason: Took away the dropboxlinks since i works with the link from my wp
March 30, 2017 at 10:44 pm #769675Hey ChristianEnglen!
You can not execute PHP for security reasons, yes.
You can try something like https://wordpress.org/plugins/allow-php-execute/
and try if it works
If not, then best case is to create a shortcode with your output and after use it where you wantCheers!
BasilisMarch 31, 2017 at 9:40 am #769807Thanks for Your reply…
I understood that it might have something to do with security. But then I just don’t understand how one is supposed to ‘write/show’ the values from the fields created by the plugin ‘Woocommerce Custom Fields’. It seems strange to be able to create data to put in tables etc as example, and then not have the possibility to show this data on my site.
It’s not your fault at all, I’m just thinking out loud.
Is there any other solution? What I want to do is…
1: Use the fantastic Theme Enfold [check]
2: Add WooCommerce [check]
3: Create custom productpage in Enfold [check, did that via Advanced Layout Builder]
4: Make my custom productpage the default productpage [not succeded]
5: Create custom dataproperties per product [check, via Woocommerce Custom Fields]
6: Make my custom dataproperties viewable on my productpages [not succeded, cause php is not allowed]
7: Import productdata from Google spreadsheet to create products [check, via plugin WP All Import (great plugin bu the way)]I understand this is not on Enfold theme to solve. But I guess that my problem is a quite common one. Pretty many will wanna create their own product-pages. But why do that if it’s hard (impossible?) to make this custom product-page the default template, and for plugins like WP All Import to import data to that specific template, instead of the out-of-the-box-template.
Thanks for your time :)
April 1, 2017 at 2:56 pm #770325Hi ChristianEnglen,
Well, you cannot execute php there, but you might be able to use a shortcode there.
Here is some reading on the subject:
https://www.sitepoint.com/custom-shortcodes-for-wordpress/
http://www.wpbeginner.com/beginners-guide/7-essential-tips-for-using-shortcodes-in-wordpress/
https://wp-types.com/documentation/user-guides/shortcodes-within-shortcodes/If you need further assistance please let us know.
Best regards,
VictoriaApril 3, 2017 at 2:22 pm #771140Thanks Victoria + Basilis,
You truly are great. Such a wonderful customersupport. Thanks. I’ve to admit, part of the question was (and some parts still are) due to my incompetence. My apologies.
I think I found a possible answer. I created parts of the problem myself when I created my own product-page. Cause, creating an productpage of my own, with my limited understanding of wp/php, made me disable parts that my other features that the plug-in Woocommerce Custom Fields needed.
What I didn’t know is…
1. The output of the values I made in product properties (in the plugin Woocommerce Custom Fields) don’t show in a layout I’ve created with the Advanced Layout Builder within the Enfold theme.
2. I’ve also did not understand that I need to make the property public AND have a value within the property.So, now, I’ve added som text into a few properties AND made them properties public AND created a product that uses the default-template within WooCommerce.
So, now I see the values, in other words I see the output I wanted. I still (I’m a demanding person, I know) would like the output to show in my custom template, in other words, I would like to use my custommade producttemplate when I do product-imports via the plugin WP All Import.
So, to summarize, for those interested.
1. Enfold is great. Truly great theme and support.
2. Plugin Woocommerce Custom Fields gives you the chance to add extra fields for both frontend + backend.
3. Plugin WP All Import makes it possible to import and update your product via for example a Google spreadsheet. The plugin can even identify the custom fields created by the plugin Woocommerce Custom Fields.The only caveat, is… that all this happens within the standard default product layout. No offence, but I’d love to have the same possibillities within my custommade producttemplate.
Victoria and Basilis, thanks again. You can close this topic.
April 5, 2017 at 7:24 pm #772775Hi ChristianEnglen,
Thanks for sharing! Sounds like you had great learning experience! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.