Link to contact page with subject of product name or ID

LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

Is it possible (without major modification of current code) to get a link in the a product page to send an id/title to the contact us page (prefill) the subject field. 

With regards to the contact us mod.
https://www.litecart.net/en/forums/2/general-discussions/18912/hide-price-when-0-and-replace-with-contact-form

When the customer clicks contact us link it will prefill the field with the item they are asking about.

thanks

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

Put ?subject=Lorem+ipsum+dolor in the URL of the contact page to prefill the subject field.


<a href="<?php echo document::href_ilink('customer_service', ['subject' => $name]); ?>">Quote For Price</a>
<?php } ?>```
LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

hi tim
thanks for the reply

adding in code (to box_product.inc.php): 
<a href="<?php echo document::href_ilink('customer_service', ['subject' => $name]); ?>">Quote For Price</a>

i am getting error {snippet:notices} {snippet:breadcrumbs}

also can you please explain what this means in more detial?

[i]Put ?subject=Lorem+ipsum+dolor in the URL of the contact page to prefill the subject field.[/i]

[i]thanks[/i]

LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

thanks, but i am not understanding. could you clarify where this code should be put?

<?php if ($final_price == 0) { ?>
<a href="<?php echo document::href_ilink('customer_service', ['subject' => $name]); ?>">Quote For Price</a>
<?php } ?>

i understand putting 
Put ?subject=Lorem+ipsum+dolor in the URL of the contact page to prefill the subject field.

but not how to get that to happen from the product page? thanks

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

Put the code in box_product.inc.php where you would want the link displayed.
See logs/errors.log for any errors.

LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

thanks, i have used the stock box_product.inc.php file and this works, so i need t figure out how to integrate into the ZERO price mod
https://www.litecart.net/en/forums/2/general-discussions/18912/hide-price-when-0-and-replace-with-contact-form

<?php  if ($final_price == 0) {
   
echo '
[b]<a href="<?php echo document::href_ilink('customer_service', ['subject' => $name]); ?>">Quote For Price</a>[/b]

'
;
          }else{ ?>

ill try again
thanks again

LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

thank got it working, 
https://www.litecart.net/en/addons/594/hide-price-if-zero-0-mod-zero-0-stock-contact-button

would you be able to help more with how the prefill works?
['subject' => $name]

how can i know what else i can call and send to the contact us page as prefill?

for example, we have "subject" as the "product title", ['subject' => $name]
what about if we wanted to have the message body pre filled with :

" hello, can you please send me an update on "product title" made by "manufacturer" and or "other"  data from the product listing? "

thanks

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

LiteCart will identify any passed HTTP GET or POST parameters matching the input field name and prefill them (apart from files and passwords).

By including a URL parameter named message with a value it will prefill the message field as well. If the value is tremendously long you can attempt HTTP POSTing the values to the page instead. To do so simply produce a form holding the input (type=hidden) values. The form action URL should be the contact page.

LiteCart Fan
Tól től Australia
Tagság ápr. 2023 óta

thanks, this may still be a little to hard for me to understand without exmaple.
['message' => $mpn, 'subject' => $name]
i have figure out that much? but struggle with formatting 
like how to do 'message' => $mpn + $sku + some text
but 'message' => $manufacturer does not work?

how can i find which $items i can use?

thanks again

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

The variables you can use are defined in pages/product.inc.php.
Inside the template file you can do var_dump(get_defined_vars()); to see all that are defined for that environment.
https://www.php.net/manual/en/function.get-defined-vars

If you wish to fetch something that isn't defined inside your variable scope in LiteCart you can use the reference model to get it from the database:
reference::product($product_id)->mpn
https://wiki.litecart.net/introduction#reference_objects

To glue strings together in php use dot:

'message' => $mpn .' '. $sku .' '. some text
https://www.php.net/manual/en/language.operators.string.php

Te
Ez a weboldal nem használ cookie-kat és nem használ harmadik féltől származó nyomkövetési technológiát. Úgy gondoljuk, hogy jobban tudjuk csinálni, mint mások, és tényleg gondolunk az Ön magánéletére.