Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter MeatRo

    (@meatro)

    I 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
    Example2

    Gets 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. ??

    Thread Starter MeatRo

    (@meatro)

    Here is an example:

    https://www.reuseautoparts.com/item/2013-hyundai-genesis-used-rh-quarter-window-glass-tint-2-0t-coupe-r-spec-9812/

    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.

    Thread Starter MeatRo

    (@meatro)

    Resolved.

    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'];
    					}
    Thread Starter MeatRo

    (@meatro)

    Very 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.)

    Thread Starter MeatRo

    (@meatro)

    Resolved

    Thread Starter MeatRo

    (@meatro)

    Very 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!!

    Thread Starter MeatRo

    (@meatro)

    Ok, 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.

    Thread Starter MeatRo

    (@meatro)

    Yes, 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.

Viewing 8 replies - 1 through 8 (of 8 total)