Jump to content



Photo
- - - - -

[Addon] Price in Cart Only/MAPP Support


  • Please log in to reply
12 replies to this topic

#1   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 09 May 2013 - 03:45

This addon allows you to show the price of any product only after it has been added to the cart. This satisfies some manufacturers' "Minimum Advertised Price Policies" (MAPP).

You can select this option for any product when you first add the product to your store, or you can edit any product later. When selected, the product price is replaces with text and a link to an explanatory popup. You can change any of this text at any time.

This Addon should only be used when the manufacturer has a minimum advertised price for certain products and you price is lower. Customers generally don't like hidden prices.

The code is here.

Regards
Jim

Edited by kymation, 09 May 2013 - 03:50.

See my profile for a list of my addons and ways to get support.


#2   Nico01

Nico01
  • Members
  • 26 posts
  • Real Name:Nico Simandiris
  • Gender:Male

Posted 14 May 2013 - 00:14

Hallo Jim,

thanks for sharing your work.

I run v2.3.3 on 5.5.27 - MySQL.

I got this Error:

1054 - Unknown column 'p.price_in_cart' in 'field list'

select products_id, products_image, products_tax_class_id, products_price, p.price_in_cart from products where products_status = '1' order by products_date_added desc limit 10


all files are original from your code, nothing modified on my testing area.

Thanks for info
Nico

#3   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 14 May 2013 - 00:17

It sounds like you didn't run the price_in_cart.sql to modify your database. Do that now.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#4   Nico01

Nico01
  • Members
  • 26 posts
  • Real Name:Nico Simandiris
  • Gender:Male

Posted 14 May 2013 - 08:47

Jim, I did it.

For sure I set up again - same error issue.

This is, what I run in sql:


ALTER TABLE `products` ADD `price_in_cart` SET( 'True', 'False' ) NOT NULL DEFAULT 'False' AFTER `products_price`

Maybe I forget something...

Nico

#5   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 14 May 2013 - 17:01

That should work. Check that the price_in_cart column has been added to the products table in your database.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#6   Nico01

Nico01
  • Members
  • 26 posts
  • Real Name:Nico Simandiris
  • Gender:Male

Posted 14 May 2013 - 23:56

Yes, it is.

[img]http://localhost/phpmyadmin/themes/dot.gif[/img] Edit [img]http://localhost/phpmyadmin/themes/dot.gif[/img] Copy [img]http://localhost/phpmyadmin/themes/dot.gif[/img] Delete 28 100 GT-P1000 samsung/galaxy_tab.gif 749.9900 True 2013-05-14 06:49:58 2013-05-14 07:11:17 2013-05-16 00:00:00 1.00 1 1

If I want to edit the product in the description, I can't remove the checkmark, because it is vanished.

Strange, but I let you know, if I found a solution, but I am stll learning ...

Thanks for your help

Nico

#7   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 15 May 2013 - 00:10

I didn't read the first error message that you posted well enough. My bad. In whatever file that is, replace p.price_in_cart with price_in_cart.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#8   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 15 May 2013 - 00:34

As I posted above, there is a bug in the What's New box code. I've posted a new release containing the fix. If you have the previous version, just replace catalog/includes/modules/boxes/bm_whats_new.php with the one from this new release.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#9   Nico01

Nico01
  • Members
  • 26 posts
  • Real Name:Nico Simandiris
  • Gender:Male

Posted 16 May 2013 - 00:38

Jim, its working now, thanks.

Only the pop up doesn't show up.

Could be there a missing link from


// Price in Cart notice overrides the price display
if( $product_info['price_in_cart'] == 'True' ) {
$products_price = tep_display_price_in_cart();
}

in product_info.php

to


// Display the Price in Cart notice
if( !function_exists( 'tep_display_price_in_cart' ) ) {
function tep_display_price_in_cart() {
$price_string = '<span class="price_in_cart">' . PHP_EOL;
$price_string .= TEXT_ADD_CART_FOR_PRICE . '&nbsp;' . PHP_EOL;
$price_string .= ' <span class="smalltext">' . PHP_EOL;
$price_string .= ' <script language="javascript"><!--' . PHP_EOL;
$price_string .= 'document.write(\'' . '<a href="javascript:popupWindow(\\\'' . tep_href_link( FILENAME_POPUP_PRICE_IN_CART ) . '\\\')">' . TEXT_WHY_HIDE_PRICE . '</a>\');' . PHP_EOL;
$price_string .= '//--></script>' . PHP_EOL;
$price_string .= ' <noscript>' . PHP_EOL;
$price_string .= ' <a href="' . tep_href_link (FILENAME_POPUP_PRICE_IN_CART, 'cond=' . $data['rating']) . '" target="_new">' . TEXT_WHY_HIDE_PRICE . '</a>' . PHP_EOL;
$price_string .= ' </noscript>' . PHP_EOL;
$price_string .= ' </span>' . PHP_EOL;
$price_string .= '</span>' . PHP_EOL;

return $price_string;
}
}
// Price In Cart end

in functions/general.php ?

Excuse this kind of question, but I try to understand the code ....

Thanks
Nico

#10   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 16 May 2013 - 00:46

The code in product_info.php (and every other file that displays the price) calls the function tep_display_price_in_cart(). That function returns a string of code that displays the text telling the customer to add the item to their cart to see the price and a link to the popup explaining why. I'll go test this again, but I'm not seeing a reason why this would not work.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#11   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 16 May 2013 - 02:25

The problem was that i left out some critical files. Of course it worked on my test site since it had all the files. Anyway, the new release with the missing files is up, and there are update instructions in the User's manual. I also added some styling that I left out of the stylesheet, if you want to use it. Or just style it yourself.

Regards
Jim

See my profile for a list of my addons and ways to get support.


#12   Nico01

Nico01
  • Members
  • 26 posts
  • Real Name:Nico Simandiris
  • Gender:Male

Posted 16 May 2013 - 09:44

Jim, now everything is working.

For the pop up window I had to change something to make it working:

In template_top.php the function:


window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=450,height=550,screenX=150,screenY=150,top=150,left=150')\n";
}

in



window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
}

So I removed \n"; - and now its pop up.

Thanks for working this out.
Regards
Nico

#13   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 9,643 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 16 May 2013 - 18:14

I missed that. Thanks for letting me know, and thank you for your previous bug reports as well. They really help.

I'm thinking about changing that popup to a jQuery dialog box. I'll work on that when I have time.

Regards
Jim

See my profile for a list of my addons and ways to get support.