I have an e-commerce store and I want to start blogging for it. I not only want to blog about my products but also write about other topics for affiliate marketing revenue. Should I just do blogging on my store website (www.domainname.com/blog)? Or should I start blogging on a separate channel and call it "blog.domainname.com"? How would it affect my page ranking?
Since Shaun's answer accurately addresses the main question, I am going to address this in a slightly non-technical, business-strategy way that does not deal directly with SEO rankings.
As a business, the blog is really to get people to learn about you, your e-commerce store, and your products. I'd suggest that you consider a self-hosting account on Medium so that you get the best of both worlds - your blog becomes more discoverable due to Medium's extensive network and you still have a custom domain name (blog.domain.com). This may or may not fit in into SEO wisdom, but works very well from a business perspective. I'm not sure how your affiliate marketing attribution is done, but I don't imagine that will be impacted whether you use Medium, Wordpress, or a simple HTML page to power your blog.
I've seen more and more companies move away from running after rankings through technical SEO manipulation. As long as your content is relevant to the audience coming to your website and they spend more and more time on your website, your ranking will continue to improve. Any short-term "hack" you make to improve rankings outside of content will be short-lived. So do you what you'd do normally to get more business for your business.