WordPress.org

Ready to get started?Download WordPress

Forums

WP Catalogue
[resolved] Add product price on Product Grid (5 posts)

  1. lozadaOmr
    Member
    Posted 7 months ago #

    I am not trying to make an e-commerce site, but would be glad if it possible to add the product price of the item, on the product grid view?

    My website is here
    http://wordpress.org/plugins/wp-catalogue/

  2. Maeve Lander
    Member
    Plugin Author

    Posted 6 months ago #

    WP Catalogue is not an eCommerce plugin. You can manually add a buy button to each product post if you want, but for a serious eCommerce site I would recommend you use a plugin that is built to do that job. Personally, my eCommerce plugin of choice is Shopp

  3. lozadaOmr
    Member
    Posted 6 months ago #

    No, I am not trying to make an e-commerce site, I only wanted to display the product price on grid view.

    I managed to display it if it is alright, I can post the solution so if others want it if it is okay. (I just played the plugin and managed to make it work.)

  4. neglosh
    Member
    Posted 6 months ago #

    Hey lozadaOmr,
    could you please share your solution?

    Thanks in advance

  5. lozadaOmr
    Member
    Posted 6 months ago #

    I would suggest you backup your plugin first, test it on a localhost server.

    1. Go and edit wpc-catalogue.php
    2. Add the following code

    //Added this part after the $post_data = get_post($post->ID, ARRAY_A);
    // Which basically came from single-wpcproduct.php
    $terms1 = get_the_terms($post->id, 'wpccategories');
    if($terms1) {
    
    foreach( $terms1 as $term1 ) {
     $slug = $term1->slug;
     $tname = $term1->name;
     $cat_url = get_bloginfo('siteurl').'/?wpccategories=/'.$slug;
     };
    }

    Then look for this part of the code

    while($products->have_posts()): $products->the_post();

    and insert this code

    //this the code for fetching the price
    		$product_price = get_post_meta(get_the_id(), 'product_price', true);

    After this part

    $price = get_post_meta(get_the_id(),'product_price',true);

    Then look for this line of code, and insert $product_price like this one

    $return_string .= '<p class="wpc-title"><a href="'. $permalink .'">'.$title.'₱'.$product_price.'</a></p>';

    Sorry, for the complicated instructions I was just messing with the plugin files, and eventually made it work.

Reply

You must log in to post.

About this Plugin

About this Topic