X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Changing the "Ask a question about this product" form (https://forum.x-cart.com/showthread.php?t=66658)

David-Allan 04-17-2013 06:35 AM

Changing the "Ask a question about this product" form
 
Hi Everyone,

I'm looking to adjust the "Ask a question about this product" popup page. We use this for people to request a sample and need the popup to have name, address and post code and they must be set to required.

I have found the code for the form and the php that deals with the email but I don't really know how to adjust these.

Has anyone changed this before?

If the worst comes to the worst I could always just make it a link to the contact us page but this won't include the product page that the customer came from.

suseela 04-17-2013 04:49 PM

Re: Changing the "Ask a question about this product" form
 
hello, i am using the 2 column design. Home Shopping Cart Contact Us links are at the top just below the search bar. I need to add the sell with us link. Can you tell me the exact tpl i need to edit. Thanks so much for the help.

David-Allan 04-18-2013 12:04 AM

Re: Changing the "Ask a question about this product" form
 
Quote:

Originally Posted by suseela
hello, i am using the 2 column design. Home Shopping Cart Contact Us links are at the top just below the search bar. I need to add the sell with us link. Can you tell me the exact tpl i need to edit. Thanks so much for the help.


You don't need to edit any tpl files to add new links to the speedbar. Just click on content then speedbar from the admin control panel and add what you want from there.

David-Allan 04-18-2013 12:05 AM

Re: Changing the "Ask a question about this product" form
 
Anyone? got any ideas on how to edit the ask a question about this product popup?

PhilJ 04-18-2013 01:12 AM

Re: Changing the "Ask a question about this product" form
 
ok, I put this together quickly for you... tested and working fine on v4.5.5

1) skin/common_files/customer/main/ask_question.tpl

After...

Code:

    <tr>
      <td class="data-name"><label for="phone">{$lng.lbl_phone}</label></td>
      <td>&nbsp;</td>
      <td>
        <input type="text" name="phone" id="phone" value="" size="30" />
      </td>
    </tr>


Insert...

Code:

    {*--------------------------------*}

    <tr>
      <td class="data-name"><label for="sample">Request a Sample</label></td>
      <td>&nbsp;</td>
      <td>
        <input type="checkbox" name="sample" id="sample" />
      </td>
    </tr>

    <tr style="display:none" class="samples">
      <td colspan="3">
        <div class="field-container">
          <div class="data-name">
            <label for="product" class="data-required">Product</label>
          </div>
          <div class="data-value">
            <input type="text" name="product" id="product" value="{$product.product}" style="width:100%" readonly />
          </div>
        </div>
      </td>
    </tr>

    <tr style="display:none" class="samples">
      <td colspan="3">
        <div class="field-container">
          <div class="data-name">
            <label for="address" class="data-required">Address</label>
            <span class="star">*</span>
          </div>
          <div class="data-value">
            <textarea name="address" id="address" rows="4" style="width:100%"></textarea>
          </div>
        </div>
      </td>
    </tr>

    {literal}
    <script type="text/javascript">
    $("input#sample").click(function(){
        if($("input#sample").attr('checked')) {
            $(".samples").fadeIn();
        }else{
            $(".samples").fadeOut();
        }
    });
    </script>
    {/literal}

    {*--------------------------------*}



2) In popup_ask.php

After...

Code:


        || empty($_POST['question'])



Insert...

Code:


        || ($_POST['sample'] == "on" && empty($_POST['address'])) // XCARTMODS ADDED



Then after...

Code:

    $mail_smarty->assign('product',  $product['product']);

Insert...

Code:

    $mail_smarty->assign('sample',    $_POST['sample']); // XCARTMODS ADDED
    $mail_smarty->assign('address',    $_POST['address']); // XCARTMODS ADDED


Then after...

Code:

$smarty->assign('productid',    $productid);

Insert...

Code:

$smarty->assign('product',    $product); // XCARTMODS ADDED

3) In skin/common_files/mail/html/ask_question.tpl

After...

Code:

{if $phone}
<tr>
<td><b>{$lng.lbl_phone}:</b></td>
<td>&nbsp;</td>
<td>{$phone|escape}</td>
</tr>
{/if}


Insert...

Code:

{if $sample eq "on"}
<tr>
<td><b>Sample Requested:</b></td>
<td>&nbsp;</td>
<td>Yes</td>
</tr>
<tr>
<td><b>Address:</b></td>
<td>&nbsp;</td>
<td>{$address|escape}</td>
</tr>
{/if}


4) Do a template cleanup.

Done :)

David-Allan 04-18-2013 01:57 AM

Re: Changing the "Ask a question about this product" form
 
I haven't tried this yet Phil but your a superstar, no idea how you can put this together so quickly.

Your a coding genius.

I'll give it a try shortly after I figure out this bloody mysql left join milarky i'm working on arrgghhh drives me mad.

PhilJ 04-18-2013 02:04 AM

Re: Changing the "Ask a question about this product" form
 
:) left joins can be pain, might be able to help, PM me

David-Allan 04-18-2013 02:23 AM

Re: Changing the "Ask a question about this product" form
 
Phil that works a treat and looks so easy once you know how.

Thank you so much for your help

David-Allan 04-18-2013 02:43 AM

Re: Changing the "Ask a question about this product" form
 
Thanks for the offer Phil i'm basically just trying to export all the products from one particular category in to a SQL or CSV file so I can import them in to a new DB.

I thought i couldn't do this in xcart but I have just found that you can by searching for products and selecting the category and putting nothing else in then just export these results.


All times are GMT -8. The time now is 09:53 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.