Woocommerce include parent product in title of child product - woocommerce

I have a multiple grouped products with simple product options set up like this:
Photograph Name (Parent Grouped Product):
7" x 4" framed
7" x 4" unframed
Is there a way to get the simple (child) product name to automatically suffix the parent product name when displayed in the cart.
Currently shows: "7" x 4" framed"
Want it to show: "Photograph Name - 7" x 4" framed"
I know the long way would be to input the data manually when creating the product. But that seems counter intuitive.
Any best practice / php snippets would be great thanks!
John

This is odd because what you are asking is the deault in the theme I am using. I would like to remove the parent product name in the grouped product listing.
The code I have for the link in the grouped.php is:
' . $child_product['product']->post->post_title . '
Is this what you have?
Bridie

Related

Scraping an item that varies in position from a XML subpage

so far I didn't succeed in scraping the table "Die Verlustursache" from this page
http://www.ubootarchiv.de/ubootwiki/index.php/U_205
using libraries (XML) (rvest) (readr)
I can address all tables on the site with individual code lines like
table <-readHTMLTable("http://www.ubootarchiv.de/ubootwiki/index.php/U_203") %>% .[1]
but the numeric numbers vary on all the other sites.
check for example: http://www.ubootarchiv.de/ubootwiki/index.php/U_27
I just realized that the table I need is always the fourth last one (meaning: the last table minus 4).
In another scraping project, I once used this line to only scrape the last item of a list page:
html_nodes(xpath="/html/body/div/div[3]/div[2]/div[1]/div[2]/div/table/tbody/tr[last()]"
However, I was not able to find a solution for something like "last - 4"
Please advise & Thx in advance
You could use this if it is always the fourth last table:
table <-readHTMLTable("http://www.ubootarchiv.de/ubootwiki/index.php/U_203")
table[length(table) - 4]

LibreOffice Writer define and use dynamic variables for caption labels

When you insert a caption it automatically increments the value for the caption number e.g if I insert a caption named "Illustration" for each image in my document, LibreOffice will automatically append an integer to my caption such that I get "Illustration 1", "Illustration 2", "Illustration 3" ....
I'm writing a document and sometimes refer to the illustrations in the text. But the diagram for "Illustration 2" may change if I add a new image before it.
Is there a way to dynamically bind the auto increment as a variable in my text? I.e if I add 3 images before "Illustration 2", the image it refers to will become ""Illustration 5".
Can I make my text now refer to "Illustration 5" instead of "Illustration 2"?
You can do this by using a cross-reference field. Let's say you insert your first two illustrations. In this case you can insert a field that refers to your "Illustration 2" by going to Insert -> Field -> More fields, then going to the cross-references tab. Now select the type you're interested in below "type", set "insert reference to" to "category and number", finally select the second illustration under "selection" and press "insert".
This way if you add 3 more images before the second one, your field will be automatically updated to say 5 after insertion.

Using "Allow Text Entry" result as Piped Data in a Loop & Merge block

I have a multiple select option that allows text entry for an "other" choice at the bottom. Then I use the selected options from that question in a Loop & Merge block with a collection of other questions. I can the piped text variable ${lm://Field/1} to get the selected question, as a header for the next block, for example:
Please tell me more about ${lm://Field/1}
But on the "other" choice, that will just say:
Please tell me more about other
I would like it to use the value of the Text Entry field, but I can't find a piped text variable that would give me that.
You want to pipe "Selected Choices - Entered Text" aka:
${q://QID1/ChoiceGroup/SelectedChoicesTextEntry}
That will pipe the text entry of the selected choice(s) that have text entry and the selected choice(s) for the choices that don't have text entry.
Follow the steps below:
In Loop & Merge you choose "Loop based off of a question", and
select the choose-all-that-apply Multiple Answer question that has
the "Other" question with "Allow text entry" set to on.
In the adjacent drop down, choose "Selected Choices - Entered Text [object Object]".
Now, in your questions inside your Loop and Merge block, pipe the Loop & Merge field in the normal way with ${lm://Field/1}.

xquery- how to put a 'range' condition on some nodes' immediately previous and next sibling nodes

Kindly take a look at the sample below--
<div class="patent_bibdata">
<b> First list</b>
Name #1
Name #2
<b> Second list</b>
Name #2_1
Name #2_2
</div>
Now, I want to extract the links after the 'b' element that has text "First List"-- however, I dont want the links after the 'b' element that has text "Second list"-- and the number of links after "First List" is not known to me.
What I thought of, is something like this--
....XQuery code defining the document as variable named "doc"
let $list:= $doc/div[ #class="patent_bibdata"]/b[. = 'First list']/following-sibling::text() -- but this should get everything after 'First list'-- including 'Second List' and 'Name #2_1' and 'Name #2_2'
Now, only the text in the 2 'b' tags-- (i.e. 'Name #1' and 'Name #2' in our example) are known to me-- so I think I have to somehow put conditions and retrieve the links (that I need), putting conditions on the immediate-predecessor-sibling and immediate-successor-sibling of those links--- what are the commands to put those conditions(if I am right so far)? And if I am not right, then how do I go about getting that set of links?
This works:
$doc/div[ #class="patent_bibdata"]/b[. = ' First list']/following-sibling::a[not(preceding-sibling::b[. = ' Second list'])]
Considering the amount of rather basic questions you asked today about XQuery it might be advisable to get a fundamental understanding about XQuery first. There are some very good books out there, I especially like the one from Priscilla Walmsley.

How to know how many parents for a specific category?

In WordPress is there a way where we can know the number of parents categories of a current category:
-Parent 1
-Parent 2
- Parent 3
- Current Category
So the function can tell me that the current category has 3 parents.
get_category_parents in wp-includes/category-template.php returns a string containing all parents listed as:
Parent 1:seperator:Parent 2:seperator:Parent 3:seperator:Current Category
So it is possible to get the number of parent categories in the following way:
$ number_of_parents = sizeof(explode(', ', (get_category_parents($category_id, TRUE, ', ')))) - 1;
There might be a better/more efficient way of doing this though. But if maximum performance is not that important, the above should be good enough.

Resources