[Skip to main content](#vessel-content)

#   Hide "add to cart button" when brand-url is filled out

##

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 9 months ago [\#261042](#261042) by [river](/forum/user/9591-river "View river's Profile")  *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261042 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")* was created by *[river](/forum/user/9591-river "View river's Profile")*

-- HikaShop version -- : 3
-- Joomla version -- : 3.6.5
-- PHP version -- : 7

So iv'e used the code (below) and created a "buy now" button that links to external products (when I fill out brand url) Code:

&lt;input type="button" onclick="window.location='&lt;?php echo $this-&gt;row-&gt;product_url; ?&gt;'; return false;" value="buy now"/&gt;

I placed it in the file product &#124; quantity and it works perfect.

Anyway I have a question:

Is it possible to write aa php code to create a function that hide's the native "add to cart" button on the product page when the "brand URL" of the product is filled out ?

Would it be something like this
if($this-&gt;row-&gt;hikashop_product_url_main == 1)
{
$this-&gt;row-&gt;addtocartoption = 0;
}

?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

9 years 9 months ago -  9 years 9 months ago [\#261066](#261066) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261066 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

Hello,

In theory of course you can, but we need more context in order to better understand your needs, and maybe their is an **HikaShop option** that can fit your needs better than a custom code?

Awaiting news from you.

Regards

Last edit: 9 years 9 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 9 months ago -  9 years 9 months ago [\#261257](#261257) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261257 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

OK this is what my product page on my test-site looks like now.

[ ![tester22222.jpg](/forum/attachment/36070) ](/forum/attachment/36070 "tester22222.jpg")

When I paste a URL in the in the product "brand url" field the button "Gå til forhandler/Go to dealer" links to this url.

But now both button displays. I need the standard "add to cart" button to be HIDDEN when the product "brand url" is filled out

So that only the new button "go to dealer" displays.

NOTE: I know that I can use code to remove the standard "add to cart" button, but I have some products that I sell myself so I need it to display on these products.

Any advice on how two write code like that ?

tnx

How my explenation makes more sense. ![=)](/smile.gif "=)")

- [ ![tester22222.jpg](/forum/attachment/36070) ](/forum/attachment/36070 "tester22222.jpg") [ ](/forum/attachment/36070?download=1 "tester22222.jpg")

Last edit: 9 years 9 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 9 months ago [\#261260](#261260) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261260 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

Hi,

I suppose you could add such code at the top of the "quantity" view file: Code:

&lt;?php if(!empty($this-&gt;element-&gt;product_url)) return; ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 9 months ago -  9 years 9 months ago [\#261317](#261317) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261317 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

OK tnx for reply

This works ! Excellent.

Now the begining of my product &#124; quantity file look like this
Code:

&lt;input type="button" onclick="window.location='&lt;?php echo $this-&gt;row-&gt;product_url; ?&gt;'; return false;" value="Gå til forhandler!&gt;"/&gt;&lt;br/&gt; &lt;?php if(!empty($this-&gt;element-&gt;product_url)) return; ?&gt; &lt;?php /** * @package HikaShop for Joomla! * @version 3.0.0 * @author hikashop.com * @copyright (C) 2010-2017 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */

Is it possible to add another small function to this code.

Now both buttons are displaying when the "Brand url" is NOT filled out.

Is if possible to add code so that ONLY the "add to cart" but is displaying when the "Brand url" if NOT filled out ?

Last edit: 9 years 9 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

9 years 9 months ago [\#261322](#261322) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261322 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

Hi,

You should only display your custom code when the product_url is not fill.
It is simply an improvement of the content of the "if" that Nicolas gave you.

Even if it's basic PHP code ; I'm afraid that it is starting to become some custom code and we are starting to go outside of the limit of the HikaShop support.
I recommend you to read some articles in order to learn the base of PHP, so you will be able to move forward in your HikaShop customization.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 9 months ago -  9 years 9 months ago [\#261358](#261358) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261358 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

Tnx for reply

Yes I know that its a simple improvement of the content of the "if"
Code:

&lt;input type="button" onclick="window.location='&lt;?php echo $this-&gt;row-&gt;product_url; ?&gt;'; return false;" value="Gå til forhandler!&gt;"/&gt;&lt;br/&gt; &lt;?php if(!empty($this-&gt;element-&gt;product_url)) return; ?&gt; &lt;?php

So does anyone else have some advice on what piece of code to add to the last code-sentence so it hides my custom button "Gå til forhandler/Go to dealer" when the "Brand URL" of the product is not filled.

?

Any advice would be GREATLY appreciated ![:)](/media/kunena/emoticons/3.png ":)")

Last edit: 9 years 9 months ago by [river](/forum/user/9591-river "View river's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

9 years 9 months ago [\#261397](#261397) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261397 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

Hi,

Like I told you in my previous post, your request is more a request for "custom code" than support on HikaShop.
You want to modify the HikaShop view, change the behavior, the page of the content and the way that your website is "acting".
So it is going outside of the limit of our support.

Thank you for your understanding

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[river](/forum/user/9591-river "View river's Profile")**
- [![river's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar9591.gif)](/forum/user/9591-river "View river's Profile") Topic Author
- [ Offline](/forum/user/9591-river)

Less More

- Posts: 344
- Thank you received: 3
-
-

9 years 9 months ago [\#261447](#261447) by [river](/forum/user/9591-river "View river's Profile")  Replied by *[river](/forum/user/9591-river "View river's Profile")* on topic *[Hide "add to cart button" when brand-url is filled out](/forum/26-product-category-display/888612-hide-add-to-cart-button-when-brand-url-is-filled-out#261447 "-- HikaShop version -- : 3 -- Joomla version -- : 3.6.5 -- PHP version -- : 7  So iv'e used the code (below) and created a &quot;buy now&quot; button that links to external products (when I fill out brand url)  I placed it in the file product | quantity and it works perfect.  Anyway I have a question:  Is it possible to write aa php code to create a function that hide's the native &quot;add to cart&quot; button on the product page when the &quot;brand URL&quot; of the product is filled out ?  Would it be something like this if($this-&gt;row-&gt;hikashop&#95;product&#95;url&#95;main == 1) { $this-&gt;row-&gt;addtocartoption = 0; }  ?")*

OK I understad.

I will make a post under commerical jobs.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODg2MTItaGlkZS1hZGQtdG8tY2FydC1idXR0b24td2hlbi1icmFuZC11cmwtaXMtZmlsbGVkLW91dD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.076 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
