Jump to content

Custom text + include when not on stock but can be ordered


Recommended Posts

I'm trying to modify my PS 1.6 installation with Blackhawk 3.1 theme.

 

At the product page i would like to add a static text + read a line from a .txt file.

But this function should only be visible when the product is available for backorder.

When selecting a different stock variant, the message should not be displayed.

 

This is ok:

post-408579-0-12623000-1436108617_thumb.jpg

 

This should be removed:

post-408579-0-58569700-1436108617_thumb.jpg

 

I did some rookie research, and have tried the following:

 

Added this to /classes/Product.php

	public function orderDate()
	{
		$f = fopen("bestillingsdato/dato.txt", "r");
		$bestillingsdato = fgets($f); 
		fclose($f);
		return $bestillingsdato;
	}

Added the h1 code to /themes/blackhawk3.1/product.tpl at line 215

<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span><h1 itemprop="name">{l s='Bestillingsvarer bliver bestilt senest '}{$product->orderdate}</h1>				

(Don't mind the h1 tags ect.. This is testing only.)

This just inserts the text line with no text from the dato.txt file. (yes the files exist and have data in it.)

 

Bear with me since I'm all rookie, and I'm learning by doing :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...