luigidefra Posted September 21, 2020 Share Posted September 21, 2020 Hi, In my project I can create a new domain only in bundle with shared hosting, then i need hide Register a new domain on header and left bar, how can i do? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 23, 2020 Share Posted September 23, 2020 On 21/09/2020 at 18:38, luigidefra said: Hi, In my project I can create a new domain only in bundle with shared hosting, then i need hide Register a new domain on header and left bar, how can i do? there are multiple ways - depending on how thorough you need to be... you could use CSS (in custom.css) or hooks to hide the links - though if the user knew the URL to the domain register page, then they could still register domains that way... #Primary_Navbar-Store-Register_a_New_Domain {display: none;} #Secondary_Sidebar-Actions-Domain_Registration {display: none;} another way would be to disable domain registration in the settings (e.g setup -> general settings -> domains -> domain registration options -> untick "Allow clients to register domains with you". that disables domain registrations on their own and with products too, so then you could write a hook to enable the register domain option on specific products only and then only the products can you list will be able to register domains when ordering - other products, and direct domain registrations will be prevented. 0 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted September 24, 2020 Author Share Posted September 24, 2020 21 hours ago, brian! said: another way would be to disable domain registration in the settings (e.g setup -> general settings -> domains -> domain registration options -> untick "Allow clients to register domains with you". that disables domain registrations on their own and with products too, so then you could write a hook to enable the register domain option on specific products only and then only the products can you list will be able to register domains when ordering - other products, and direct domain registrations will be prevented. which hook should i implement? by doing so when i select a product i will also be shown the page to choose the domain? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 24, 2020 Share Posted September 24, 2020 24 minutes ago, luigidefra said: which hook should i implement? it would be ClientAreaPageCart - though ClientAreaPage would work too. 24 minutes ago, luigidefra said: by doing so when i select a product i will also be shown the page to choose the domain? yes. this is a hook i've posted before (in many forms), but it allows you to specify which domain options are available for each product, e.g for some products, they can register a domain; for another product, they can register, transfer but not use own domain etc... for your issue, i've simplified the code a little... <?php # Configure Domain Settings For Products # Written by brian! function domain_options_for_products_hook($vars) { $productinfo = $vars['productinfo']; if ($vars['templatefile']=="configureproductdomain") { $validproducts = array(1,2); if (in_array($productinfo['pid'],$validproducts)) { return array("registerdomainenabled" => "on", "domainoption" => "register"); } } } add_hook("ClientAreaPageCart", 1, "domain_options_for_products_hook"); so what this says is that for the product IDs listed in the $validproducts array (that's 1 & 2), the domain options will include Domain Registration (even if disabled in the settings) and it will be the default choice... if transfer/owndomain options are enabled, then they'll be shown too (along with subdomain if that's applicable with the product) - 1 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted November 12, 2020 Author Share Posted November 12, 2020 Hi Brian, I am still writing to you about it. I set the .it domain for € 10, then I set up shared hosting including a domain and set the free .it domain for it. The cart shows me two items. The first item is shared hosting including the free .it domain. The second is the .it domain at a full price of € 10. So I have a problem, if I delete shared hosting from the cart I can only buy the domain at full price and I shouldn't be allowed. I should only have shared hosting including its free domain in my cart 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 13, 2020 Share Posted November 13, 2020 21 hours ago, luigidefra said: So I have a problem, if I delete shared hosting from the cart I can only buy the domain at full price and I shouldn't be allowed. it would be expected behaviour, when you remove a hosting product with domain (free or not), for the domain to remain in at the cart - but be charged at full price. on your site, can users not register domains directly - they *must* be bought with products ? I suspect i've posted hooks before that prevent checkout if there are domains, but no products in the cart. 0 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted November 16, 2020 Author Share Posted November 16, 2020 On 11/13/2020 at 5:05 PM, brian! said: on your site, can users not register domains directly - they *must* be bought with products ? I suspect i've posted hooks before that prevent checkout if there are domains, but no products in the cart. At this moment on my site if I buy a hosting but I stop at the confirmation of the choice of the domain without buying the hosting I find only the domain in the cart. Same behavior if I complete the purchase (hosting + domain) and then delete the hosting from the cart, I find only the domain in the cart. It is true that he would buy the domain at full price but I just don't want to buy it 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 17, 2020 Share Posted November 17, 2020 well the reason why I asked if you can register domains directly is because if you don't, then it would make the prevention hook easier... e.g if cart contains a domain with no products at checkout, then prevent checkout. hiding the option for the user to remove individual products would also prevent the issue lol. 0 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted November 19, 2020 Author Share Posted November 19, 2020 On 11/17/2020 at 6:01 PM, brian! said: well the reason why I asked if you can register domains directly is because if you don't, then it would make the prevention hook easier. On 9/21/2020 at 7:38 PM, luigidefra said: Hi, In my project I can create a new domain only in bundle with shared hosting, then i need hide Register a new domain on header and left bar, how can i do? so, how can i do? you say to delete through hook all the domains with no products at checkout? Please help me 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted November 19, 2020 Share Posted November 19, 2020 You can try using ShoppingCartValidateCheckout hook to check for domains within $_SESSION[‘cart’] and then returning error "blah product requires a domain registration, please pick a domain" and provide a link to the domain checker page. If you want it to be specific to a product, then going through the items in the cart and check their pids against an array of pids that you want to be required to have a domain registration and return error as needed. 0 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted November 23, 2020 Author Share Posted November 23, 2020 (edited) DELETED Edited November 23, 2020 by luigidefra RESOLVED 0 Quote Link to comment Share on other sites More sharing options...
luigidefra Posted November 23, 2020 Author Share Posted November 23, 2020 On 11/19/2020 at 10:54 PM, steven99 said: You can try using ShoppingCartValidateCheckout hook to check for domains within $_SESSION[‘cart’] and then returning error "blah product requires a domain registration, please pick a domain" and provide a link to the domain checker page. If you want it to be specific to a product, then going through the items in the cart and check their pids against an array of pids that you want to be required to have a domain registration and return error as needed. There is no hook to remove the item in the cart? So when a Domain or Hosting is deleted automatically remove the respective Domain or Hosting it belongs to 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.