Start & End Sale Date

  • Posts: 4
  • Thank you received: 0
13 years 2 weeks ago #31934

Start and End Sale Dates on each product seem like a very good way to manage these items in the system that we have. I read the documentation and it sounds like the products still show up but if someone tries to order them they just get a message that they can't be ordered now (if not within the sale dates).

Is there a way to make it so the items are hidden instead? So people won't see the items until they are on sale?

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
13 years 2 weeks ago #31953

There is no option for that. But you could do it by installing that small plugin

file removed, please use the file in the post #128950

Last edit: 10 years 6 months ago by Jerome.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
13 years 2 weeks ago #32111

hey, thanks so much for your efforts on this. I realize how helpful you are being on this.
Installed the plugin, I enabled it, it gives this error:

Fatal error: Call to undefined method JDatabaseMySQL::isAdmin() in /home/tfcmain/public_html/copy/plugins/hikashop/hide_products.php on line 10

Maybe this matters: we are on Joomla 1.5.23 and Hikashop Business 1.5.3

Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
13 years 2 weeks ago #32145

The line:
$app =& Jfactory::getDBO();
should be :
$app =& Jfactory::getApplication();

in that plugin and that will remove that error.

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 4
11 years 9 months ago #92551

I know this topic is old, but I really need this plugin.

Maybe it is because of the hikashop version (I use the last one), but the plugin doesn't works fine : when I enable it, the product with an old end sale date disappears from the site (front and back). In front it is perfect, but not in backoffice.

If I disable the plugin, I can see the product. So, there are 'just' hidden when the plugin is enabled. But it would be much better if the plugin hide them in front, but not in backoffice. (it would be perfect if the plugin can unpublised these products...)

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
11 years 9 months ago #92772

I don't understand your message.

The plugin is working fine for me. It hides the products only on the frontend if their start date is in the future of if their end date is in the past. That's it. It doesn't remove them from the backend at all.

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 4
11 years 9 months ago #92831

En front il n'y a pas de soucis, les produits plus en vente sont bien "cachés", mais ils sont cachés en backoffice aussi. Ce qui est assez ennuyant tout de même.
Ils ne sont pas supprimés, puisque si je désactive le plugin les produits réapparaissent, et en front et en back.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 9 months ago #92900

Je viens de vérifier le contenu du plugin et si l'interface est backend alors, le plugin n'effectue aucune modification du listing de produits.
Toutefois vous pouvez l'éditer afin de changer son comportement, pour qu'il change le status des produits qui ne sont pas dans les dates de vente en désactivé.

Pouvez vous coller les lignes présentes dans la fonction "onBeforeProductListingLoad()" de ce plugin ?

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 4
11 years 9 months ago #92904

Voilà pour le code du plugin :

function onBeforeProductListingLoad(&$filters){
    	$app =& Jfactory::getDBO();
    	if($app->isAdmin()) return;
		$filters[]='b.product_sale_start<'.time();
		$filters[]='(b.product_sale_end=0 OR b.product_sale_end>'.time().')';
    }

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 9 months ago #92905

Merci de remplacer "$app =& Jfactory::getDBO();" par "$app =& Jfactory::getApplication();".

Please Log in or Create an account to join the conversation.

  • Posts: 101
  • Thank you received: 4
11 years 9 months ago #92913

Super, merci !

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
11 years 2 months ago #128950

Note that the plugin I posted more than a year ago won't install on Joomla 3 as at the time it couldn't be compatible with it.
Here is a version which is compatible with Joomla 3.

File Attachment:

File Name: hab7bb9c.zip
File Size:1 KB

Attachments:
The following user(s) said Thank You: cb75ter, OA

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 6
10 years 8 months ago #153001

You guys should make this a standard plugin that you ship. We have been using a hacky workaround for years.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 6
10 years 6 months ago #157991

So, we have been using this and it works pretty well. The problem is that it hides the product on both the front end and back end. So, when we set the start date to the future, the product disappears and we can't edit it again until after the start date. Can this be corrected?

I see in the code that it attempts to return if the use is admin

if($app->isAdmin()) return;

but this doesn't seem to work. We are still on hika 2.0

Thanks

Last edit: 10 years 6 months ago by mtense. Reason: added detail

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 6 months ago #158030

Hi,

I just checked the plugin code, and that should work fine. Are you sure that you don't have an old override or edition present in your code ?

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 6
10 years 6 months ago #158206

Yes, I am sure. To double-check, I setup a test installation

  • latest version of joomla
  • hika business 2.0
  • hide products plug in
That is all. Then i added two products. One product I set start sale date to tomorrow. If I enable the hide product plugin, the product disappears from both front and back end. If I disable the plugin, the product comes back.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 6
10 years 6 months ago #158207

The fix is pretty simple. In the version of the plugin I had the code looked like this

$app =& Jfactory::getDBO();
if($app->isAdmin()) return;

I changed this to

$app = JFactory::getApplication();
if($app->isAdmin()) return;

And it started working correctly.

The following user(s) said Thank You: Jerome

Please Log in or Create an account to join the conversation.

  • Posts: 26165
  • Thank you received: 4029
  • MODERATOR
10 years 6 months ago #158231

Hi,

Thanks for the patch.
The weird thing is that, in my side (when I look at the source code of the plugin in our repository), the variable $app is right initialized with the application and not with the DBO.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 6
10 years 6 months ago #158236

There are two attachments on this thread. Somehow I ended up with the first. Kind of my mistake. I suggest deleting the first one and make renaming the second one to hide_product.zip. Maybe that is how I ended up with the bad code. The good code has a bad zip name ;)

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 0
1 year 1 month ago #356827

Is the plugin file in this post also compatible / ready for Joomla 4 and 5?
www.hikashop.com/support/forum/4-how-to/...ale-date.html#128950


Best regards,
Wouter

Please Log in or Create an account to join the conversation.

Time to create page: 0.124 seconds
Powered by Kunena Forum