Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Author « Topic »  

redshad
Starting Member

USA
14 Posts

Posted - 01/14/2022 :  06:55:33  
Is it possible to include code within a Product Long Description? Or better yet, use something like a Product Attribute to determine whether or not to include a php file in the Product Long Description or at least include on the product detail page?

Let me explain further... For certain products, our inventory is kept by Lot#. This is info stored in a separate database. I would like to include a php file that displays the lot#'s and grams in stock for each lot# as part of the product detail page... but only for certain products.

Here is an example from our non-ECT website with the additional info shown in a pop-up:


Vince
Administrator

41216 Posts

Posted - 01/14/2022 :  12:23:48  
Hi Redshad
This isn't possible at the moment, but how about if in the $detailpagelayout you could add a parameter to include an include file. For instance...

$GLOBALS['detailpagelayout']="productimage,productname,discounts,price,options,addtocartquant,include:vsadmin/myincludefile.php";

Then you could add whatever PHP code you wanted in the file "myincludefile.php". The product ID would be available to your include file so you could use that to query your database.

Like I say, this isn't possible right now but I think it would be a good addition to the cart. Would this work for you? Something similar could be done on the products page.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

redshad
Starting Member

USA
14 Posts

Posted - 01/18/2022 :  05:11:40  
Thank you so much for the suggestion. I will give this a try.

redshad
Starting Member

USA
14 Posts

Posted - 01/18/2022 :  06:11:23  
Hmmmm.... missing something. This just adds and line of text to the product detail page: UNKNOWN LAYOUT OPTION:include:vsadmin/myincludefile.php

dbdave
ECT Moderator

USA
9509 Posts

Posted - 01/18/2022 :  06:19:14  
Hi, this is a feature that may be added, but not available right now

quote:
Like I say, this isn't possible right now but I think it would be a good addition to the cart. Would this work for you? Something similar could be done on the products page.


David

redshad
Starting Member

USA
14 Posts

Posted - 01/18/2022 :  08:17:20  
Ahhh... misinterpreted "this isn't possible right now" to referring to what I ask, as apposed to what you suggested. So to answer your question, Yes, this would be a great addition. Thanks.

dbdave
ECT Moderator

USA
9509 Posts

Posted - 01/18/2022 :  10:15:14  
I think it's possible that Vince is working on some updates and has a plan for this to be added.
I think it would be a good feature too, so hopefully something is in the works.

David

Vince
Administrator

41216 Posts

Posted - 01/18/2022 :  14:07:30  
Hi Redshad
quote:
I think it's possible that Vince is working on some updates and has a plan for this to be added.
We've got the changes ready for this but will need to do some more testing before it is ready. As I mentioned the idea would be to have an additional parameter "include" in the $detailpagelayout or $productpagelayout like this...

$detailpagelayout="productimage,productname,discounts,price,options,addtocartquant,include:vsadmin/myincludefile.php";

...with the include filename after the colon in "include:vsadmin/myincludefile.php"

quote:
I think it would be a good feature too, so hopefully something is in the works.
Unfortunately for ASP users this will just be for PHP sites as there just isn't a way to do a dynamic include in ASP. Sorry Dave.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Vince
Administrator

41216 Posts

Posted - 01/19/2022 :  05:35:25  
Hi Redshad
Changes ready now here...
https://www.ecommercetemplates.com/updaters.asp?betas=true

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Vince
Administrator

41216 Posts

Posted - 01/21/2022 :  01:13:05  
I should give more details about how to access the product details from within your "include" file. Here is an example for instance...

<?php
print '<div class="custominc">' . $GLOBALS['rs']['pId'] . '</div>';
?>

This will display a div with the product id, something which you could do with just "productid" in the page layout anyway. You also have access to the other "products" table columns by just changing "pId" for the column name.

Here is another example though where you could pull a column that isn't available from the products table...

<?php
$incSQL="SELECT pName FROM products WHERE pId='" . escape_string($GLOBALS['rs']['pId']) . "'";
$incresult=ect_query($incSQL) or ect_error();
if($incrs=ect_fetch_assoc($incresult)){
print '<div class="custominc">My Inc File: ' . $incrs['pName'] . '</div>';
}
?>

You could use that same technique to query your own database table.

Do remember to use the escape_string() function to escape any parameters used to query the database.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2021 ecommercetemplates.com
This page was generated in 0.04 seconds. Snitz Forums 2000