Jump to content

Availability date: Grid Style Order form


Recommended Posts

Hi Guys. I am working on a Grid Style Order form.. as attached 
 
I would like to to pull data from the DB for the available_date thats under Table: product_attribute.
 
This is the current code i have found 
 

<span id="availability_date_label">{l s='Availability date:'}</span>
<span id="availability_date_value">{if Validate::isDate($product->available_date)}{dateFormat date=$product->available_date full=false} {/if}</span>

 
with the above code its only displaying the Available date for the product as a whole and not as a variants.

 

I am not a programer but i enjoy trying to solve the problem myself before posting. But this time I give up. Its been over a week of trial and error. 

 

Can any body help.

Please 

Thank you 

 

post-836566-0-10178000-1468240931_thumb.png

Link to comment
Share on other sites

I can't find any option in the Back Office to set a different availability date for each attribute, but assuming you've found a way to do it, you could use the following code to get the dates in a TPL file with a $product object:

{assign var='product_attributes' value=Product::getProductAttributesIds($product->id|intval)}
{foreach from=$product_attributes item='product_attribute'} 
    Available date for product attribute {$product_attribute.id_product_attribute|intval}: {Product::getAvailableDate($product->id|intval, $product_attribute.id_product_attribute|intval)}<br />
{/foreach}

Hopefully, you can get it to work and adapt the code to your needs.

Link to comment
Share on other sites

I can't find any option in the Back Office to set a different availability date for each attribute, but assuming you've found a way to do it, you could use the following code to get the dates in a TPL file with a $product object:

{assign var='product_attributes' value=Product::getProductAttributesIds($product->id|intval)}
{foreach from=$product_attributes item='product_attribute'} 
    Available date for product attribute {$product_attribute.id_product_attribute|intval}: {Product::getAvailableDate($product->id|intval, $product_attribute.id_product_attribute|intval)}<br />
{/foreach}

Hopefully, you can get it to work and adapt the code to your needs.

 

Rocky, Thank you very much for your kind reply.

The option to assign a date for each attribute is under the Product, Combination section. Select a combination and Click "Edit". I attached a screenshot. 

 

The DB colomn I am trying to pull us under - Table: xx_product_attribute, available_date

 

I tried the code you gave me but unfortunately I did not manage to get it to work. :-( 

 

Wish I was 20 years younger and studied how to code.. :-(

 

Rocky, Your help is much appreciated.

Cheers

 

post-836566-0-49198400-1468406874_thumb.png

Link to comment
Share on other sites

How exactly isn't it working on your website? Did you get a blank page? If so, try editing config/defines.inc.php and change PS_DEV_MODE from false to true to get an error message we can use to solve the problem.

Link to comment
Share on other sites

How exactly isn't it working on your website? Did you get a blank page? If so, try editing config/defines.inc.php and change PS_DEV_MODE from false to true to get an error message we can use to solve the problem.

Hi Rocky 

Sorry mate. Its working now. but its looking like this. Attached.

I think its something to do with the {foreach from=$product_attributes item='product_attribute'} 

But I cant figure it out.. 

 

Thank you so much rocky.

post-836566-0-97574600-1468458249_thumb.png

 

Rocky, if you could also please PM me your email contact I would like to send you an email.

Cheers 

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...