0
The problem:

I am using MusCol to display music and a component called J2Store to manage purchases. At present I can create a song as a product in J2Store, then enter the product page in the MusCol song's buy link. The user then goes to the product page and adds the product to the cart.
This is too many steps for my liking, and I would like to have the add to cart button for a song appear on it on the album page (SEE ATTACHED IMAGE)

My attempted fix:

J2Store allows a shortcode - {j2store}X|cart{/j2store} - which I can insert into html fields to call the cart button for a product (where X is the product ID). In MusCol the 'review' field allows HTML, so if I can call the review in another field I can get the cart button, so for the 'Price' field on the Album page, I added album->review ?> which then calls and executes the shortcode, and I have a cart button for the album. So far so good.

Where I'm stuck:

Unfortunately in the song itself, simply echoing $this->song->review doesn't work, I assume because I'm not on the song page.
I noticed that you call {{name}} and {{artist}} to get the title and artist for the song, but when I try {{review}} I get the shortcode echoed as text and html tags, rather than a button.

The questions:

How can I get the shortcode from the song's review field to echo correctly and add a cart for the song to the song area on the album page?
Is there a way I can make one of the other album fields on the admin page accept the shortcode instead of putting it in review? (I use the review field for other things to so if I could make Edition Details (or something) work instead that would be great).

Thanks.

Accepted Answer

Thursday, November 28 2019, 11:50 AM - #Permalink
0
because you're in the ALBUM page, and on that page, the REVIEW field is being pre-processed in look for plugins before rendered.
this does NOT happen for the songs in that page, because they're loaded after the initial page load, using an additiona AJAX call to the backend.
The reply is currently minimized Show
Responses (6)
  • Accepted Answer

    Wednesday, November 27 2019, 03:45 PM - #Permalink
    0
    jeffmcbiscuit wrote:

    so for the 'Price' field on the Album page, I added album->review ?> which then calls and executes the shortcode, and I have a cart button for the album. So far so good.


    Should read .... $this->album->review
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, November 27 2019, 03:49 PM - #Permalink
    0
    Also image didn't upload. Why can't I edit a forum post???
    Attachments:
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, November 28 2019, 11:27 AM - #Permalink
    0
    hi

    yes, this won't work because the songs's "review" field is loaded using AJAX and is NOT processing any content plugins in it (like the j2store plugin you need)
    this would require actually to trigger the plugin process in the backend, prior to sending the info to the frontend.

    but that could cause problems as well, because this plugin *might* require some additional Javascript that is not loaded in the page...

    this will require custom coding in any case...
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, November 28 2019, 11:30 AM - #Permalink
    0
    I have sent a request about custom coding for this, please can you check your mail so we can discuss?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, November 28 2019, 11:45 AM - #Permalink
    0
    Can you please explain why it works for the album review field and not the song?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, November 28 2019, 11:57 AM - #Permalink
    0
    I seeeeeee. I thought something like that was the case, but I didn't understand why. I'm happy to continue this by email for custom code and wiill mark this as answered.
    The reply is currently minimized Show
Your Reply