MeatRo
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Preserving New Lines via APII don’t know in too much detail how it works.. I just know that the WooCommerce API strips out any delimiters such as a line break. The top code is the original and it’s stripping out delimiters.
The bottom code is what I changed it to, which basically passes the attributes to the API and keeps them in their original format.
Then here is the VB code that pulls the multiline attributes from my Access Database and passes them to the API:
If Not IsDBNull(dr("ptFitment")) Then Dim objatt2 = New ProductAttribute() objatt2.name = "Fitment" objatt2.options = Regex.Replace(dr("ptFitment"), Environment.NewLine, "<br>") objatt2.visible = True objattribute1.Add(objatt2) End If If Not IsDBNull(dr("ptNotes")) Then Dim objatt3 = New ProductAttribute() objatt3.name = "Fitment Notes" objatt3.options = Regex.Replace(dr("ptNotes"), Environment.NewLine, "<br>") objatt3.visible = True objattribute1.Add(objatt3) End If
It’s finding any new lines (Environment.NewLine) and replacing it with the HTML tag. So when it is passed to the API, it looks like this:
Example1
Example2Gets passed as:
Example1Example2
… Then in the API code itsel, above.. I pulled out the part that strips delimiters. Because any NewLine, BR, etc was being removed and everything was getting passed like this:
Example1Example2
I hope this helps, but it was a looong time ago. ??
Forum: Plugins
In reply to: [WooCommerce] Adding Attributes via APIHere is an example:
You can see under “Additional Information” the Part Type attribute, in the Shop page, there should be a filter for the Part Type attribute, so somebody could select Glass (that particular part type) and find this item.
However, it does not display because WordPress thinks there are no items with Part Type attribute with value of Glass.
Here is code of how it is going up…
From Product module…
Public Property attributes() As List(Of ProductAttribute) Get Return m_attributes End Get Set(value As List(Of ProductAttribute)) m_attributes = value End Set End Property Private m_attributes As List(Of ProductAttribute) Public Class ProductAttribute Public [name] As String Public [options] As String Public [visible] As Boolean Public [slug] As String End Class
From posting module…
If Not IsDBNull(dr("ptInter")) Then Dim objatt1 = New ProductAttribute() objatt1.name = "Hollander" objatt1.options = dr("ptInter") objatt1.visible = True objattribute1.Add(objatt1) End If objpro.attributes= objattribute1
Lots of other properties are also assigned to objpro, such as objpro.images, objpro.in_stock, stock_quantity, etc, etc.
Only thing that is not correct is actually assigning the attributes to the item so that they display correctly in the back end as well. The way they are, they are displaying correctly in front-end, but still all attributes under Products->Attributes show 0 entries..
Very confusing. This is the only issue that I am having.
Thank you.
Forum: Plugins
In reply to: [WooCommerce] Preserving New Lines via APIResolved.
In /includes/api/class-wc-api-products.php
} elseif ( isset( $attribute['options'] ) ) { // Array based if ( is_array( $attribute['options'] ) ) { $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', $attribute['options'] ) ); // Text based, separate by pipe } else { $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', explode( WC_DELIMITER, $attribute['options'] ) ) ); }
Changed to
} elseif ( isset( $attribute['options'] ) ) { // Array based if ( is_array( $attribute['options'] ) ) { $values = $attribute['options']; // Text based, separate by pipe } else { $values = $attribute['options']; }
Forum: Plugins
In reply to: [Offers for WooCommerce] Plugin Stopped Working on Live SiteVery sorry. I’ve been trying to get this resolved for hours, only cause was I was logged in as admin. As soon as I logged out, offers came through perfectly.
Thank you (it was seeing your offer come in that made me finally realize that.)
Forum: Plugins
In reply to: [Offers for WooCommerce] Make Offer Tab IconResolved
Forum: Plugins
In reply to: [Offers for WooCommerce] Make Offer Tab IconVery simple… haha.. I just inserted this as the button text in settings:
<span class="icon-chat" style="font-size: 18px;margin: auto auto 10px;text-align: center;z-index: 1;position: static;left: 10px;top: 9px;background: rgba(0, 0, 0, 0.25);color: #fff;display: block;height: 30px;line-height: 30px;width: 30px;"></span>
Thanks again!!
Forum: Plugins
In reply to: [Offers for WooCommerce] Make Offer Tab IconOk, I got the <span> in there.. Found that in
/public/class-offers-for-woocommerce.php
$tab_title = (isset($button_options_display['display_setting_custom_make_offer_btn_text']) && $button_options_display['display_setting_custom_make_offer_btn_text'] != '') ? $button_options_display['display_setting_custom_make_offer_btn_text'] : __( '<span class="icon-chat-empty"></span>Make Offer', $this->plugin_slug );
Now all I need to find out how to do is add the “with_icon” class to the list item..
class="tab_custom_ofwc_offer_tab "
to
class="tab_custom_ofwc_offer_tab with_icon"
Thank you! Very awesome plugin, by the way. I love it.
Forum: Plugins
In reply to: [Offers for WooCommerce] Make Offer Tab IconYes, where is the code for that button generated? It seems to come from all over the place to me, but I’m not great at JS.